1
1
mirror of https://github.com/theoludwig/advent_of_code_2023.git synced 2024-12-08 00:45:53 +01:00

ci: test both MSRV and latest stable Rust versions

This commit is contained in:
Théo LUDWIG 2024-01-27 17:49:25 +01:00
parent 21433caf63
commit abcf7c5163
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B
14 changed files with 114 additions and 30 deletions

1
.commitlintrc.json Normal file
View File

@ -0,0 +1 @@
{ "extends": ["@commitlint/config-conventional"] }

View File

@ -12,15 +12,39 @@ env:
jobs: jobs:
ci: ci:
runs-on: "ubuntu-latest" runs-on: "ubuntu-latest"
strategy:
matrix:
rust-version: ["1.70.0", "stable"]
steps: steps:
- uses: "actions/checkout@v4" - uses: "actions/checkout@v4.1.1"
- uses: "dtolnay/rust-toolchain@stable"
with:
components: "clippy, rustfmt"
- run: "rustc --version"
- uses: "dtolnay/rust-toolchain@master"
with:
toolchain: "${{ matrix.rust-version }}"
components: "clippy, rustfmt"
- run: "rustc --version"
- run: "cargo build --verbose" - run: "cargo build --verbose"
- run: "cargo test --verbose" - run: "cargo test --verbose"
- run: "cargo clippy --verbose -- -D warnings" - run: "cargo clippy --verbose -- -D warnings"
- run: "cargo fmt -- --check" - run: "cargo fmt -- --check"
lint-markdown:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4.1.1"
- uses: "DavidAnson/markdownlint-cli2-action@v15.0.0"
with:
config: ".markdownlint-cli2.jsonc"
globs: "**/*.md"
lint-commit:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4.1.1"
- uses: "wagoid/commitlint-github-action@v5.4.5"
with:
configFile: ".commitlintrc.json"
failOnWarnings: true

31
.markdownlint-cli2.jsonc Normal file
View File

@ -0,0 +1,31 @@
{
"config": {
"default": true,
/* Disables rules that may conflict with Prettier */
/* Reference: https://github.com/DavidAnson/markdownlint/blob/main/style/prettier.json */
"blanks-around-fences": false,
"blanks-around-headings": false,
"blanks-around-lists": false,
"code-fence-style": false,
"emphasis-style": false,
"heading-start-left": false,
"hr-style": false,
"line-length": false,
"list-indent": false,
"list-marker-space": false,
"no-blanks-blockquote": false,
"no-hard-tabs": false,
"no-missing-space-atx": false,
"no-missing-space-closed-atx": false,
"no-multiple-blanks": false,
"no-multiple-space-atx": false,
"no-multiple-space-blockquote": false,
"no-multiple-space-closed-atx": false,
"no-trailing-spaces": false,
"ol-prefix": false,
"strong-style": false,
"ul-indent": false
},
"globs": ["**/*.md"]
}

8
Cargo.lock generated
View File

@ -174,9 +174,9 @@ checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.8.0" version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051"
dependencies = [ dependencies = [
"either", "either",
"rayon-core", "rayon-core",
@ -184,9 +184,9 @@ dependencies = [
[[package]] [[package]]
name = "rayon-core" name = "rayon-core"
version = "1.12.0" version = "1.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2"
dependencies = [ dependencies = [
"crossbeam-deque", "crossbeam-deque",
"crossbeam-utils", "crossbeam-utils",

View File

@ -2,7 +2,13 @@
members = ["day_*"] members = ["day_*"]
resolver = "2" resolver = "2"
[workspace.package]
name = "advent_of_code_2023"
version = "1.0.0"
edition = "2021"
rust-version = "1.70.0"
[workspace.dependencies] [workspace.dependencies]
rayon = { version = "=1.8.0" } rayon = { version = "=1.8.1" }
indicatif = { version = "=0.17.7", features = ["rayon"] } indicatif = { version = "=0.17.7", features = ["rayon"] }
array-init = { version = "=2.1.0" } array-init = { version = "=2.1.0" }

View File

@ -1,4 +1,4 @@
MIT License # MIT License
Copyright (c) Théo LUDWIG Copyright (c) Théo LUDWIG

View File

@ -2,14 +2,29 @@
## About ## About
This repository contains my solutions for the [Advent of Code 2023](https://adventofcode.com/2023) challenges implemented in the [Rust Programming Language](https://www.rust-lang.org/) v1.74.0. This repository contains my solutions for the [Advent of Code 2023](https://adventofcode.com/2023) challenges implemented in the [Rust Programming Language](https://www.rust-lang.org/).
## Getting Started
### Prerequisites
The current Minimum Supported [Rust](https://www.rust-lang.org/) Version (MSRV) is **1.70.0** (determined thanks to [cargo-msrv](https://crates.io/crates/cargo-msrv)).
The project is **tested** against the following Rust versions:
- **Minimum Supported Rust Version (MSRV): v1.70.0**
- **Latest Stable Version**
### Usage
```sh ```sh
# Run the tests
cargo test
# Run a specific day's challenge (e.g. Day 1) # Run a specific day's challenge (e.g. Day 1)
cargo run --package day_1 cargo run --package day_1
# Build, Lint, and Test
cargo build
cargo test
cargo clippy --verbose -- -D warnings
cargo fmt -- --check
``` ```
## License ## License

View File

@ -1,6 +1,7 @@
[package] [package]
name = "day_1" name = "day_1"
version = "1.0.0" version.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]

View File

@ -1,6 +1,7 @@
[package] [package]
name = "day_2" name = "day_2"
version = "1.0.0" version.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]

View File

@ -1,6 +1,7 @@
[package] [package]
name = "day_3" name = "day_3"
version = "1.0.0" version.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]

View File

@ -1,6 +1,7 @@
[package] [package]
name = "day_4" name = "day_4"
version = "1.0.0" version.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]

View File

@ -1,7 +1,8 @@
[package] [package]
name = "day_5" name = "day_5"
version = "1.0.0" version.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]
rayon = { workspace = true } rayon = { workspace = true }

View File

@ -1,7 +1,8 @@
[package] [package]
name = "day_6" name = "day_6"
version = "1.0.0" version.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]
rayon = { workspace = true } rayon = { workspace = true }

View File

@ -1,7 +1,8 @@
[package] [package]
name = "day_7" name = "day_7"
version = "1.0.0" version.workspace = true
edition = "2021" edition.workspace = true
rust-version.workspace = true
[dependencies] [dependencies]
array-init = { workspace = true } array-init = { workspace = true }