From 69acaa7ea40563cc91435adf93ceafda67c81241 Mon Sep 17 00:00:00 2001 From: James Goodall Date: Thu, 16 Mar 2023 10:22:27 +0000 Subject: [PATCH] feat(CI): Add CI: Github CI files taken from https://github.com/jonhoo/rust-ci-conf Squashed commit of the following: commit 5ea59356dc9379a08dff5bf3df3c5016df2ca7f3 Author: Jon Gjengset Date: Sun Mar 12 09:40:09 2023 -0700 Remove -Zmiri-tag-raw-pointers as it's now default commit a076ec1cb42e88e6444ae7f573570ec53c149074 Author: Jon Gjengset Date: Sat Mar 11 15:08:45 2023 -0800 Minimal token permissions See https://github.com/tokio-rs/tokio/pull/5072 commit 9afb0e111adcd678ef06884cf737aa9e0cf135e7 Author: Jon Gjengset Date: Sat Mar 11 15:07:39 2023 -0800 Get rid of most actions-rs bits Given that that project is unmaintained. https://github.com/actions-rs/toolchain/issues/216 commit 90999e1bd1a9dabaecd149697f69e8e26e810562 Author: Jon Gjengset Date: Fri Mar 10 21:22:30 2023 -0800 Fix install message for msrv commit 362696ab8007ef1a4779885a398286856cacf555 Author: Jon Gjengset Date: Fri Mar 10 21:16:35 2023 -0800 Move to maintained rust installer See https://github.com/actions-rs/toolchain/issues/216 commit d6bd5c67a444a379d70a014de537c29dc77f7711 Merge: 82cbed8 c8a7835 Author: Jon Gjengset Date: Fri Dec 9 19:42:59 2022 -0500 Merge pull request #1 from jonhoo/dependabot/github_actions/codecov/codecov-action-3 Bump codecov/codecov-action from 2 to 3 commit c8a7835b2f0b21d9a64e6a8b0ddc10fbc88e2dd1 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat Dec 10 00:25:41 2022 +0000 Bump codecov/codecov-action from 2 to 3 Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/v2...v3) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] commit 82cbed84f82e8538cdfc99dcf1b8b2cbab4fb126 Author: Jon Gjengset Date: Fri Dec 9 16:25:21 2022 -0800 Notify if actions themselves are outdated commit cf47d4cad4b241a30245a51aa1ac7e99e7fedf8a Author: Jon Gjengset Date: Wed Sep 28 18:23:39 2022 -0700 ignore is a list commit b783cb31ab3c6c27ad826bde44aa917c0d0908da Author: Jon Gjengset Date: Fri Sep 23 08:53:07 2022 -0700 Use dependabot, but only for major versions commit 441dc27e4d1e365bfc9b0c25e736da6cb1d15102 Author: Jon Gjengset Date: Sun Sep 18 14:01:04 2022 -0700 Allow examples and binaries to require features commit ea198cc4991e2f869cd99cb8175652576ef15119 Author: Jon Gjengset Date: Sun Sep 18 13:52:47 2022 -0700 More concise name for scheduled jobs commit 15c1fa2ffcc0f31fabcdcd90cde6a05b54baf8b5 Author: Jon Gjengset Date: Sun Sep 18 12:10:58 2022 -0700 Catch upcoming deprecations commit 56d4398a24f8c7aae0ba4a74eefaf75d1c3db3a8 Author: Jon Gjengset Date: Sun Sep 18 11:52:12 2022 -0700 Merge safety workflows commit 71c2048cc0017a84a294be69d3b1629f55b1c8f0 Author: Jon Gjengset Date: Sun Sep 18 11:44:55 2022 -0700 mv github .github This should make it possible to have rust-ci-conf as a remote you merge from. commit afa25312c9c6cf8748629bd3a5c054a688785dfc Author: Jon Gjengset Date: Sun Sep 18 11:29:34 2022 -0700 Practice what you preach commit 4859c128823805015dc164d58316dc5b25a69264 Author: Jon Gjengset Date: Sat Sep 17 18:16:21 2022 -0700 Add TODOs from twitter thread commit 87365663b1f49c88c2a3642fece0b2a932001355 Author: Jon Gjengset Date: Sat Sep 17 16:19:55 2022 -0700 Missed a submodule checkout commit 99ddee84ab05f5d5f37ad30a31d18dd7c72050c9 Author: Jon Gjengset Date: Sat Sep 17 12:47:57 2022 -0700 Standardize on 'main' as branch name commit 0f90a0b77958b3978b6be3997a09ea5cb9b1bd6b Author: Jon Gjengset Date: Sat Sep 17 12:47:38 2022 -0700 Make everything use checkout@v3 commit 2de2235ad3803a978e150fca8d38182eb6ed7a9e Author: Jon Gjengset Date: Sat Sep 17 12:46:13 2022 -0700 Merge another test workflow commit 971c3fd9eb5f7d80088caaf5647a74b82d40b860 Author: Jon Gjengset Date: Sat Sep 17 12:42:52 2022 -0700 Merge another test workflow commit 0910d977fc68082220d493bef07bc9d5f2265fc7 Author: Jon Gjengset Date: Sat Sep 17 12:42:25 2022 -0700 Merge another test workflow commit 8953a88abecc66ea7811766b46aff6a5fd767124 Author: Jon Gjengset Date: Sat Sep 17 12:42:10 2022 -0700 Add first test workflow commit 3bd8b12ec08910b2609cdfc843474d5b83ff7dbc Author: Jon Gjengset Date: Sat Sep 17 12:41:57 2022 -0700 Merge another style workflow commit fe460400ed2259af7e17f5ff51742137623e9e8e Author: Jon Gjengset Date: Sat Sep 17 12:41:00 2022 -0700 Merge another style workflow commit bc3f55118617b5ffe1ea479c4f6d7d2167b86d36 Author: Jon Gjengset Date: Sat Sep 17 12:40:29 2022 -0700 Add first style workflow commit 05dd4680bf90603c70cb7cd406299675441fe59d Author: Jon Gjengset Date: Sat Sep 17 12:39:59 2022 -0700 Merge another os-check workflow commit 92379c862376607f7caca04e470c09671922f238 Author: Jon Gjengset Date: Sat Sep 17 12:39:09 2022 -0700 Add first os-check workflow commit c74ee968a1aafec9e839dee907f0137e6356feff Author: Jon Gjengset Date: Sat Sep 17 12:38:56 2022 -0700 Add (only) no-std workflow commit e6ef8e3166b93c22af938872a547e104f2601587 Author: Jon Gjengset Date: Sat Sep 17 12:38:01 2022 -0700 Merge another msrv workflow commit 1113c895d862ce860c82596cac973ad075ef1ac6 Author: Jon Gjengset Date: Sat Sep 17 12:37:31 2022 -0700 Merge another msrv workflow commit b60aa5589ac569446a5128453983dee9bb504666 Author: Jon Gjengset Date: Sat Sep 17 12:37:03 2022 -0700 Merge another msrv workflow commit 9b48ae326374d8d8609a65649026fa09f8a68c7f Author: Jon Gjengset Date: Sat Sep 17 12:36:43 2022 -0700 Add first msrv workflow commit 77079d77cb4aa288bda667917667cfaee87bd361 Author: Jon Gjengset Date: Sat Sep 17 12:36:29 2022 -0700 Add (only) miri workflow commit c65a7c4f87be9ddea9e34eb254f3b6d5933db4ef Author: Jon Gjengset Date: Sat Sep 17 12:35:09 2022 -0700 Add first minial workflow commit bf66d94f15b7288f417cfae0eab6542e2e100daf Author: Jon Gjengset Date: Sat Sep 17 12:34:43 2022 -0700 Add (only) LSAN workflow commit f67cad0f915deebcdf7ceb89ffdd0925bc910153 Author: Jon Gjengset Date: Sat Sep 17 12:34:34 2022 -0700 Add (only) loom workflow commit d8c8a99dea99b437eefc56e5b873a863a4446c51 Author: Jon Gjengset Date: Sat Sep 17 12:33:48 2022 -0700 Merge another features workflow commit 043eb24611b5272a04082d63566837a9efbc71e9 Author: Jon Gjengset Date: Sat Sep 17 12:32:58 2022 -0700 Merge another features workflow commit 922692a2977a4c93786a0ecbe11fc01501361aad Author: Jon Gjengset Date: Sat Sep 17 12:32:32 2022 -0700 Merge another features workflow commit 225ad3978688c093f4670ec04352d465076f39d3 Author: Jon Gjengset Date: Sat Sep 17 12:31:58 2022 -0700 Add first features workflow commit 1fe2a6d008275efaff56200b8fba5ecc252aa970 Author: Jon Gjengset Date: Sat Sep 17 12:31:17 2022 -0700 Merge another coverage.yml commit fe6ba380bd39c665e9d9a2153b2dc5287fe25cae Author: Jon Gjengset Date: Sat Sep 17 12:29:55 2022 -0700 Merge another coverage.yml commit bbdbd96ec709e3cc83a081cf821fdfffce85ecb5 Author: Jon Gjengset Date: Sat Sep 17 12:27:38 2022 -0700 Add first coverage workflow commit 11027d3f75ced20536b99225edccf34f286dd4e0 Author: Jon Gjengset Date: Sat Sep 17 12:27:27 2022 -0700 Add (only) ASAN workflow commit 126c9a3a35d5ac428c22883d36f0aac69d2e20e9 Author: Jon Gjengset Date: Sat Sep 17 12:25:23 2022 -0700 Place codecov config under .github commit b32648cabb5862b0814ab0abd6d5c81498758270 Author: Jon Gjengset Date: Sat Sep 17 12:24:02 2022 -0700 Merge another codecov commit 510b69615dd47cb63584976512cb95b265cb22bf Author: Jon Gjengset Date: Sat Sep 17 12:23:03 2022 -0700 Merge another codecov commit 7f34f791c0a5c3f2c2ce2ed7e43ff12ed123c62c Author: Jon Gjengset Date: Sat Sep 17 12:22:18 2022 -0700 Merge another codecov commit 1b8c3056e6a015949896ca20815719930ec48051 Author: Jon Gjengset Date: Sat Sep 17 12:21:57 2022 -0700 Merge another codecov commit 1c486b2c73cb2ae896dd77e0f0ec060a47f15cd7 Author: Jon Gjengset Date: Sat Sep 17 12:10:07 2022 -0700 Add one codecov --- .github/codecov.yml | 21 ++++++++ .github/dependabot.yml | 10 ++++ .github/workflows/check.yml | 88 +++++++++++++++++++++++++++++++++ .github/workflows/scheduled.yml | 48 ++++++++++++++++++ .github/workflows/test.yml | 85 +++++++++++++++++++++++++++++++ 5 files changed, 252 insertions(+) create mode 100644 .github/codecov.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/check.yml create mode 100644 .github/workflows/scheduled.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..ff4f571 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,21 @@ +# ref: https://docs.codecov.com/docs/codecovyml-reference +coverage: + # Hold ourselves to a high bar + range: 85..100 + round: down + precision: 1 + status: + # ref: https://docs.codecov.com/docs/commit-status + project: + default: + # Avoid false negatives + threshold: 1% + +# Test files aren't important for coverage +ignore: + - "tests" + +# Make comments less noisy +comment: + layout: "files" + require_changes: yes diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1557067 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + - package-ecosystem: cargo + directory: / + schedule: + interval: daily diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..406ba9b --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,88 @@ +permissions: + contents: read +on: + push: + branches: [main] + pull_request: +name: check +jobs: + fmt: + runs-on: ubuntu-latest + name: stable / fmt + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - name: cargo fmt --check + run: cargo fmt --check + clippy: + runs-on: ubuntu-latest + name: ${{ matrix.toolchain }} / clippy + permissions: + contents: read + checks: write + strategy: + fail-fast: false + matrix: + toolchain: [stable, beta] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install ${{ matrix.toolchain }} + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.toolchain }} + components: clippy + - name: cargo clippy + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + doc: + runs-on: ubuntu-latest + name: nightly / doc + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install nightly + uses: dtolnay/rust-toolchain@nightly + - name: cargo doc + run: cargo doc --no-deps --all-features + env: + RUSTDOCFLAGS: --cfg docsrs + hack: + runs-on: ubuntu-latest + name: ubuntu / stable / features + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: dtolnay/rust-toolchain@stable + - name: cargo install cargo-hack + uses: taiki-e/install-action@cargo-hack + - name: cargo hack + run: cargo hack --feature-powerset check --lib --tests + msrv: + runs-on: ubuntu-latest + # we use a matrix here just because env can't be used in job names + # https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability + strategy: + matrix: + msrv: [1.56.1] # 2021 edition requires 1.56 + name: ubuntu / ${{ matrix.msrv }} + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install ${{ matrix.msrv }} + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.msrv }} + - name: cargo +${{ matrix.msrv }} check + run: cargo check diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml new file mode 100644 index 0000000..0215432 --- /dev/null +++ b/.github/workflows/scheduled.yml @@ -0,0 +1,48 @@ +permissions: + contents: read +on: + push: + branches: [main] + pull_request: + schedule: + - cron: '7 7 * * *' +name: rolling +jobs: + # https://twitter.com/mycoliza/status/1571295690063753218 + nightly: + runs-on: ubuntu-latest + name: ubuntu / nightly + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install nightly + uses: dtolnay/rust-toolchain@nightly + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + - name: cargo test --locked + run: cargo test --locked --all-features --all-targets + # https://twitter.com/alcuadrado/status/1571291687837732873 + update: + runs-on: ubuntu-latest + name: ubuntu / beta / updated + # There's no point running this if no Cargo.lock was checked in in the + # first place, since we'd just redo what happened in the regular test job. + # Unfortunately, hashFiles only works in if on steps, so we reepeat it. + # if: hashFiles('Cargo.lock') != '' + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install beta + if: hashFiles('Cargo.lock') != '' + uses: dtolnay/rust-toolchain@beta + - name: cargo update + if: hashFiles('Cargo.lock') != '' + run: cargo update + - name: cargo test + if: hashFiles('Cargo.lock') != '' + run: cargo test --locked --all-features --all-targets + env: + RUSTFLAGS: -D deprecated diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8aa4488 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,85 @@ +permissions: + contents: read +on: + push: + branches: [main] + pull_request: +name: test +jobs: + required: + runs-on: ubuntu-latest + name: ubuntu / ${{ matrix.toolchain }} + strategy: + matrix: + toolchain: [stable, beta] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install ${{ matrix.toolchain }} + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.toolchain }} + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + # https://twitter.com/jonhoo/status/1571290371124260865 + - name: cargo test --locked + run: cargo test --locked --all-features --all-targets + minimal: + runs-on: ubuntu-latest + name: ubuntu / stable / minimal-versions + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: dtolnay/rust-toolchain@stable + - name: Install nightly for -Zminimal-versions + uses: dtolnay/rust-toolchain@nightly + - name: rustup default stable + run: rustup default stable + - name: cargo update -Zminimal-versions + run: cargo +nightly update -Zminimal-versions + - name: cargo test + run: cargo test --locked --all-features --all-targets + os-check: + runs-on: ${{ matrix.os }} + name: ${{ matrix.os }} / stable + strategy: + fail-fast: false + matrix: + os: [macos-latest, windows-latest] + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: dtolnay/rust-toolchain@stable + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + - name: cargo test + run: cargo test --locked --all-features --all-targets + coverage: + runs-on: ubuntu-latest + name: ubuntu / stable / coverage + steps: + - uses: actions/checkout@v3 + with: + submodules: true + - name: Install stable + uses: dtolnay/rust-toolchain@stable + with: + components: llvm-tools-preview + - name: cargo install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: cargo generate-lockfile + if: hashFiles('Cargo.lock') == '' + run: cargo generate-lockfile + - name: cargo llvm-cov + run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info + - name: Upload to codecov.io + uses: codecov/codecov-action@v3 + with: + fail_ci_if_error: true