Skip to content

Commit

Permalink
ci: add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tx committed Dec 25, 2024
1 parent 365be0f commit f318bf8
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 16 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Rust CI

on:
push:
pull_request:

env:
CARGO_TERM_COLOR: always

# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency.
# This will ensure that only one commit will be running tests at a time on each PR.
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
build:
strategy:
matrix:
rust: [ stable, nightly ]
os: [ ubuntu-latest, macos-latest ]

runs-on: ${{ matrix.os }}
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.toml') }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Build
run: cargo +${{ matrix.rust }} build --features=${{ matrix.features }}

- name: Test
run: cargo +${{ matrix.rust }} test --features=${{ matrix.features }}

clippy:
runs-on: ubuntu-latest
needs: [ "build" ]
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.toml') }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy

- name: Run clippy
run: cargo clippy -- -Dclippy::all

rustfmt:
runs-on: ubuntu-latest
needs: [ "build" ]
steps:
- name: Checkout source
uses: actions/checkout@v4

- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.toml') }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
components: rustfmt

- name: Run fmt
run: cargo fmt --all -- --check
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 8 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ members = ["cli"]

[workspace.dependencies]
advent = { git = "https://github.com/rossmacarthur/advent", rev = "33602ef987536049b79569d799603e0122fb4e0a" }
anyhow = "1.0.75"
anyhow = "1.0.94"
argh = "0.1.12"
curl = "0.4.44"
curl = "0.4.47"
itertools = "0.13.0"
open = "5.0.1"
petgraph = "0.6.5"
rand = "0.8.5"
open = "5.3.1"
rayon = "1.10.0"
regex = "1.11.1"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
thiserror = "2.0.3"
time = "0.3.30"
serde = { version = "1.0.215", features = ["derive"] }
time = "0.3.37"
toml = "0.8.8"
vectrix = "0.3.0"
yansi = "1.0.1"

[package]
Expand All @@ -27,9 +23,9 @@ publish = false

[dependencies]
advent = { workspace = true, features = ["prelude"] }
itertools = { workspace = true }
rayon = { workspace = true }
regex = { workspace = true }
rayon = "1.10.0"
itertools = {workspace = true}

[[bin]]
name = "202401"
Expand Down

0 comments on commit f318bf8

Please sign in to comment.