2024-12-13 17:47:31 -08:00
|
|
|
name: test
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
|
|
|
name: AoC 2024
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: setup toolchain
|
|
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
|
|
with:
|
|
|
|
cache: true
|
|
|
|
components: clippy, rustfmt
|
|
|
|
toolchain: stable
|
2024-12-18 15:34:05 -08:00
|
|
|
rustflags: ""
|
2024-12-13 17:47:31 -08:00
|
|
|
|
2024-12-13 23:24:24 -08:00
|
|
|
- name: install cargo-aoc
|
|
|
|
run: cargo install --locked cargo-aoc
|
|
|
|
|
|
|
|
- name: get date
|
|
|
|
id: date
|
|
|
|
run: |
|
|
|
|
echo date=$(date +%Y%m%d) > $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Get cached inputs
|
|
|
|
id: inputs
|
|
|
|
uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: input
|
|
|
|
key: ${{ steps.date.outputs.date }}
|
|
|
|
|
|
|
|
- name: Get inputs from source
|
|
|
|
if: steps.inputs.outputs.cache-hit != 'true'
|
2024-12-13 23:06:15 -08:00
|
|
|
run: |
|
2024-12-13 23:24:24 -08:00
|
|
|
cargo aoc credentials ${{ secrets.AOC_SESSION }}
|
|
|
|
for i in $(seq 1 25); do
|
|
|
|
dayfmt=$(printf %02d $i)
|
2024-12-15 01:05:57 -08:00
|
|
|
if [ ${{ steps.date.outputs.date }} -ge 202412${dayfmt} ]; then
|
2024-12-13 23:24:24 -08:00
|
|
|
cargo aoc input --year 2024 --day $i
|
|
|
|
fi
|
|
|
|
done
|
2024-12-13 23:06:15 -08:00
|
|
|
|
2024-12-13 17:47:31 -08:00
|
|
|
- name: cargo test
|
2024-12-15 01:05:57 -08:00
|
|
|
run: cargo test --lib
|
|
|
|
continue-on-error: true
|
2024-12-13 17:47:31 -08:00
|
|
|
|
|
|
|
- name: rustfmt
|
|
|
|
run: cargo fmt --all -- --check
|
2024-12-15 01:05:57 -08:00
|
|
|
continue-on-error: true
|
2024-12-13 17:47:31 -08:00
|
|
|
|
2024-12-13 23:24:24 -08:00
|
|
|
- name: clippy
|
2024-12-15 01:05:57 -08:00
|
|
|
run: cargo clippy --lib --tests -- -D warnings
|
|
|
|
continue-on-error: true
|
2024-12-13 23:24:24 -08:00
|
|
|
|
|
|
|
- name: full run
|
|
|
|
run: cargo run --release
|
2024-12-15 01:05:57 -08:00
|
|
|
continue-on-error: true
|