Skip to content

Small refactoring for day 9. #47

Small refactoring for day 9.

Small refactoring for day 9. #47

Workflow file for this run

name: Tests and Deploy
on:
push:
branches: ["2023"]
pull_request:
branches: ["2023"]
env:
CARGO_TERM_COLOR: always
jobs:
build-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --bin aoc-cli --verbose
- name: Run tests
run: cargo test --workspace --verbose
build-web:
runs-on: ubuntu-latest
steps:
- name: Checkout Crate
uses: actions/checkout@v4
- name: Checkout Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: wasm32-unknown-unknown
override: true
- name: Get Rust version
id: rustc_version
run: |
rust_version=$(rustc --version | md5sum | cut -f 1-1 -d ' ')
echo "##[set-output name=version;]$(echo $rust_version)"
- name: Restore Cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
# Generate a new cache whenever crates or rust version changes.
key: ${{ runner.os }}-cargo-${{ steps.rustc_version.outputs.version }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install trunk
working-directory: ./aoc-web
continue-on-error: true
run: cargo install trunk
- name: Build
working-directory: ./aoc-web
run: trunk build --release
env:
RUSTFLAGS: "--remap-path-prefix $HOME=~"
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: aoc-web
path: aoc-web/dist
deploy:
environment:
name: netlify
runs-on: ubuntu-latest
needs: build-web
steps:
- name: Download the artifact
uses: actions/download-artifact@v3
with:
name: aoc-web
path: ./aoc-web
- name: Publish
uses: netlify/actions/cli@master
with:
args: deploy --dir=aoc-web --prod
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}