add workflow for all years
test / AoC 2024 (push) Failing after 1m37s
test / AoC 2022 (push) Canceled after 0s
test / AoC 2025 (push) Canceled after 0s
test / AoC 2026 (push) Canceled after 0s
test / AoC 2024 (push) Failing after 1m37s
test / AoC 2022 (push) Canceled after 0s
test / AoC 2025 (push) Canceled after 0s
test / AoC 2026 (push) Canceled after 0s
This commit is contained in:
2 files changed
+106
-70
No files matched your search
@@ -1,70 +0,0 @@
|
||||
name: test-2024
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- '2024/**'
|
||||
- '.github/workflows/test-2024.yaml'
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: 2024
|
||||
|
||||
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
|
||||
cache-workspaces: 2024
|
||||
components: clippy, rustfmt
|
||||
toolchain: stable
|
||||
rustflags: ""
|
||||
|
||||
- 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: 2024/input
|
||||
key: ${{ steps.date.outputs.date }}
|
||||
|
||||
- name: Get inputs from source
|
||||
if: steps.inputs.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
cargo aoc credentials ${{ secrets.AOC_SESSION }}
|
||||
for i in $(seq 1 25); do
|
||||
dayfmt=$(printf %02d $i)
|
||||
if [ ${{ steps.date.outputs.date }} -ge 202412${dayfmt} ]; then
|
||||
cargo aoc input --year 2024 --day $i
|
||||
fi
|
||||
done
|
||||
|
||||
- name: cargo test
|
||||
run: cargo test --lib
|
||||
|
||||
- name: rustfmt
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: clippy
|
||||
run: cargo clippy --lib --tests -- -D warnings
|
||||
if: always()
|
||||
|
||||
- name: full run
|
||||
run: cargo run --release
|
||||
if: always()
|
||||
@@ -0,0 +1,106 @@
|
||||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- '2022/**'
|
||||
- '2024/**'
|
||||
- '2025/**'
|
||||
- '2026/**'
|
||||
- '.github/workflows/test.yaml'
|
||||
- 'rustfmt.toml'
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_AOC_VERSION: 0.3.8
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: AoC ${{ matrix.year }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
year: [2022, 2024, 2025, 2026]
|
||||
include:
|
||||
- year: 2024
|
||||
clippy_args: -D warnings
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ matrix.year }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: get date
|
||||
id: date
|
||||
# AoC unlocks puzzles at 00:00 EST (05:00 UTC), so shift the date back 5 hours
|
||||
run: |
|
||||
echo "date=$(date -u -d '-5 hours' +%Y%m%d)" >> "$GITHUB_OUTPUT"
|
||||
echo "week=$(date -u +%G-W%V)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: cache rustup toolchains
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.rustup
|
||||
key: rustup-${{ runner.os }}-${{ runner.arch }}-${{ steps.date.outputs.week }}
|
||||
|
||||
- name: setup toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
# caches the cargo registry and the year's target dir
|
||||
cache: true
|
||||
cache-workspaces: ${{ matrix.year }}
|
||||
components: clippy, rustfmt
|
||||
toolchain: stable
|
||||
rustflags: ""
|
||||
|
||||
- name: cache cargo-aoc
|
||||
id: cargo-aoc
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cargo/bin/cargo-aoc
|
||||
key: cargo-aoc-${{ runner.os }}-${{ runner.arch }}-${{ env.CARGO_AOC_VERSION }}
|
||||
|
||||
- name: install cargo-aoc
|
||||
if: steps.cargo-aoc.outputs.cache-hit != 'true'
|
||||
run: cargo install --locked cargo-aoc --version "$CARGO_AOC_VERSION"
|
||||
|
||||
- name: Get cached inputs
|
||||
id: inputs
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ matrix.year }}/input
|
||||
key: inputs-${{ matrix.year }}-${{ steps.date.outputs.date }}
|
||||
restore-keys: inputs-${{ matrix.year }}-
|
||||
|
||||
- name: Get inputs from source
|
||||
if: steps.inputs.outputs.cache-hit != 'true'
|
||||
env:
|
||||
AOC_SESSION: ${{ secrets.AOC_SESSION }}
|
||||
AOC_DATE: ${{ steps.date.outputs.date }}
|
||||
run: |
|
||||
year=${{ matrix.year }}
|
||||
max_day=25
|
||||
if [ "$year" -ge 2025 ]; then max_day=12; fi
|
||||
cargo aoc credentials "$AOC_SESSION"
|
||||
for i in $(seq 1 "$max_day"); do
|
||||
if [ "$AOC_DATE" -ge "$(printf '%s12%02d' "$year" "$i")" ]; then
|
||||
cargo aoc input --year "$year" --day "$i"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: cargo test
|
||||
run: cargo test --lib
|
||||
|
||||
- name: rustfmt
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: clippy
|
||||
run: cargo clippy --lib --tests -- ${{ matrix.clippy_args }}
|
||||
if: always()
|
||||
|
||||
- name: full run
|
||||
run: cargo run --release
|
||||
if: always()
|
||||
Reference in new issue
Block a user