Compare commits

..

2 Commits

Author SHA1 Message Date
b060de20c7
day11: clippies
All checks were successful
test / AoC 2024 (push) Successful in 3m7s
2024-12-13 23:44:46 -08:00
bc7ec50c94
CI: get real inputs, and do a full run 2024-12-13 23:44:29 -08:00
2 changed files with 43 additions and 49 deletions

View File

@ -2,64 +2,58 @@ name: test
on:
push:
branches: [main]
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
setup:
name: Setup
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
- uses: actions/checkout@v3
- name: setup toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
cache: true
components: clippy, rustfmt
toolchain: stable
- name: install cargo-aoc
run: cargo install --locked cargo-aoc
- 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 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 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'
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
test:
runs-on: ubuntu-latest
name: Test and Lint
steps:
- name: cargo test
run: cargo test --lib --all-features
- 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: rustfmt
run: cargo fmt --all -- --check
- name: cargo test
run: cargo test --lib --all-features
- name: clippy
run: cargo clippy --lib --all-features --tests -- -D warnings
run:
runs-on: ubuntu-latest
name: Full run
steps:
- name: full run
run: cargo run --release
- name: rustfmt
run: cargo fmt --all -- --check
- name: clippy
run: cargo clippy --lib --all-features --tests -- -D warnings
- name: full run
run: cargo run --release

View File

@ -89,7 +89,7 @@ pub fn part2(input: &str) -> IntType {
#[cfg(test)]
mod tests {
use super::*;
pub const EXAMPLE: &str = &"125 17";
pub const EXAMPLE: &str = "125 17";
#[test]
fn part1_example() {