From abcf7c5163638456a7d4d3a00150b171b8ad79e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20LUDWIG?= Date: Sat, 27 Jan 2024 17:49:25 +0100 Subject: [PATCH] ci: test both MSRV and latest stable Rust versions --- .commitlintrc.json | 1 + .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++------ .markdownlint-cli2.jsonc | 31 +++++++++++++++++++++++++++++++ Cargo.lock | 8 ++++---- Cargo.toml | 8 +++++++- LICENSE | 2 +- README.md | 23 +++++++++++++++++++---- day_1/Cargo.toml | 5 +++-- day_2/Cargo.toml | 5 +++-- day_3/Cargo.toml | 5 +++-- day_4/Cargo.toml | 5 +++-- day_5/Cargo.toml | 5 +++-- day_6/Cargo.toml | 5 +++-- day_7/Cargo.toml | 5 +++-- 14 files changed, 114 insertions(+), 30 deletions(-) create mode 100644 .commitlintrc.json create mode 100644 .markdownlint-cli2.jsonc diff --git a/.commitlintrc.json b/.commitlintrc.json new file mode 100644 index 0000000..d3d7f0c --- /dev/null +++ b/.commitlintrc.json @@ -0,0 +1 @@ +{ "extends": ["@commitlint/config-conventional"] } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c289be9..97f3085 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,15 +12,39 @@ env: jobs: ci: runs-on: "ubuntu-latest" - + strategy: + matrix: + rust-version: ["1.70.0", "stable"] steps: - - uses: "actions/checkout@v4" - - uses: "dtolnay/rust-toolchain@stable" - with: - components: "clippy, rustfmt" - - run: "rustc --version" + - uses: "actions/checkout@v4.1.1" + - uses: "dtolnay/rust-toolchain@master" + with: + toolchain: "${{ matrix.rust-version }}" + components: "clippy, rustfmt" + + - run: "rustc --version" - run: "cargo build --verbose" - run: "cargo test --verbose" - run: "cargo clippy --verbose -- -D warnings" - 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 diff --git a/.markdownlint-cli2.jsonc b/.markdownlint-cli2.jsonc new file mode 100644 index 0000000..72fb701 --- /dev/null +++ b/.markdownlint-cli2.jsonc @@ -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"] +} diff --git a/Cargo.lock b/Cargo.lock index 85d1c23..ed99b90 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -174,9 +174,9 @@ checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0" [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -184,9 +184,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", diff --git a/Cargo.toml b/Cargo.toml index 8d288a0..69c0588 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,13 @@ members = ["day_*"] resolver = "2" +[workspace.package] +name = "advent_of_code_2023" +version = "1.0.0" +edition = "2021" +rust-version = "1.70.0" + [workspace.dependencies] -rayon = { version = "=1.8.0" } +rayon = { version = "=1.8.1" } indicatif = { version = "=0.17.7", features = ["rayon"] } array-init = { version = "=2.1.0" } diff --git a/LICENSE b/LICENSE index 25dddde..e65a242 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -MIT License +# MIT License Copyright (c) Théo LUDWIG diff --git a/README.md b/README.md index 369e5b3..c4fbdb8 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,29 @@ ## 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 -# Run the tests -cargo test - # Run a specific day's challenge (e.g. Day 1) cargo run --package day_1 + +# Build, Lint, and Test +cargo build +cargo test +cargo clippy --verbose -- -D warnings +cargo fmt -- --check ``` ## License diff --git a/day_1/Cargo.toml b/day_1/Cargo.toml index 4ee878a..4e5e77c 100644 --- a/day_1/Cargo.toml +++ b/day_1/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "day_1" -version = "1.0.0" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] diff --git a/day_2/Cargo.toml b/day_2/Cargo.toml index e5fc844..b27cb84 100644 --- a/day_2/Cargo.toml +++ b/day_2/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "day_2" -version = "1.0.0" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] diff --git a/day_3/Cargo.toml b/day_3/Cargo.toml index 9db1b7c..0545eb5 100644 --- a/day_3/Cargo.toml +++ b/day_3/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "day_3" -version = "1.0.0" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] diff --git a/day_4/Cargo.toml b/day_4/Cargo.toml index 4d4e39c..c00bd94 100644 --- a/day_4/Cargo.toml +++ b/day_4/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "day_4" -version = "1.0.0" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] diff --git a/day_5/Cargo.toml b/day_5/Cargo.toml index f27f981..0da8160 100644 --- a/day_5/Cargo.toml +++ b/day_5/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "day_5" -version = "1.0.0" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] rayon = { workspace = true } diff --git a/day_6/Cargo.toml b/day_6/Cargo.toml index 57789a6..ab73974 100644 --- a/day_6/Cargo.toml +++ b/day_6/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "day_6" -version = "1.0.0" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] rayon = { workspace = true } diff --git a/day_7/Cargo.toml b/day_7/Cargo.toml index 84e76bc..eedb4b6 100644 --- a/day_7/Cargo.toml +++ b/day_7/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "day_7" -version = "1.0.0" -edition = "2021" +version.workspace = true +edition.workspace = true +rust-version.workspace = true [dependencies] array-init = { workspace = true }