From bf44d753e7d761ce2aca1e331b82dab0f92954c4 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Sat, 13 Apr 2024 12:53:11 +0200 Subject: [PATCH] check `Cargo.lock` in the CI (#43) ## [changelog](https://github.com/amtoine/nu_plugin_explore/pull/43/commits) - use the Makefile rules - check the `Cargo.lock` file (see how the CI is failing because it's not up to date) - update `Cargo.lock` (see how the CI becomes green again) --- .github/workflows/main.yml | 19 ++++--------------- .github/workflows/scripts/check-cargo-lock.sh | 5 +++++ Cargo.lock | 12 ++++++++++++ Makefile | 5 ++++- 4 files changed, 25 insertions(+), 16 deletions(-) create mode 100755 .github/workflows/scripts/check-cargo-lock.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e402d02..02497b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,9 +6,6 @@ on: name: continuous-integration -env: - CLIPPY_OPTIONS: "-D warnings" - jobs: fmt-check-clippy: runs-on: ubuntu-20.04 @@ -21,17 +18,10 @@ jobs: with: rustflags: "" - - name: Format - run: cargo fmt --all -- --check - - - name: Check the library - run: cargo check --workspace --lib - - - name: Check the tests - run: cargo check --workspace --tests + - run: make check - - name: Clippy - run: cargo clippy --workspace -- $CLIPPY_OPTIONS + - name: Check Cargo.lock + run: make lock tests: strategy: @@ -49,5 +39,4 @@ jobs: with: rustflags: "" - - name: Tests - run: cargo test --workspace + - run: make test diff --git a/.github/workflows/scripts/check-cargo-lock.sh b/.github/workflows/scripts/check-cargo-lock.sh new file mode 100755 index 0000000..65de25d --- /dev/null +++ b/.github/workflows/scripts/check-cargo-lock.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +[[ -n "$(git status --short Cargo.lock)" ]] && exit 1 + +exit 0 diff --git a/Cargo.lock b/Cargo.lock index dde51aa..679734a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,6 +372,7 @@ checksum = "f476fe445d41c9e991fd07515a6f463074b782242ccf4a5b7b1d1012e70824df" dependencies = [ "bitflags 2.4.2", "crossterm_winapi", + "filedescriptor", "libc", "mio", "parking_lot", @@ -458,6 +459,17 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "filedescriptor" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e" +dependencies = [ + "libc", + "thiserror", + "winapi", +] + [[package]] name = "flate2" version = "1.0.28" diff --git a/Makefile b/Makefile index 102144e..7b4fd2f 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,16 @@ CLIPPY_OPTIONS="-D warnings" .PHONY: all check test fmt doc build register install clean -DEFAULT: check test +DEFAULT: check lock test check: cargo fmt --all --verbose -- --check --verbose cargo check --workspace --lib --tests cargo clippy --workspace -- "${CLIPPY_OPTIONS}" +lock: check + ./.github/workflows/scripts/check-cargo-lock.sh + test: check cargo test --workspace