From 51425d524b40cbdcf6f259f5fabf17a2ae6fca5d Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Mon, 4 Sep 2023 10:39:09 +1000 Subject: [PATCH] ci: replace home-grow `cargo semver-checks` action This PR replaces our home-grown `cargo semver-checks` action with the official one: https://github.com/obi1kenobi/cargo-semver-checks-action/issues/47. This action has support for cargo workspaces and will automatically check all crates that have `publish` set to `true`. This removes a big time component for our CI checks and introduces one that runs in parallel with all others. I hope to reduce the effective CI time through that, plus it means we need to maintain less code. The official action would download the latest release of cargo-semver-checks. This might result in a non-reproducible CI. To avoid this, we retain the one-line download statement from our home-grown action. Pull-Request: #3923. --- .../actions/cargo-semver-checks/action.yml | 36 ------------------- .github/workflows/ci.yml | 22 +++++------- 2 files changed, 8 insertions(+), 50 deletions(-) delete mode 100644 .github/actions/cargo-semver-checks/action.yml diff --git a/.github/actions/cargo-semver-checks/action.yml b/.github/actions/cargo-semver-checks/action.yml deleted file mode 100644 index e9e6844f..00000000 --- a/.github/actions/cargo-semver-checks/action.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: "Run cargo semver-checks" -description: "Install and run the cargo semver-checks tool" -inputs: - crate: - required: true - description: "The crate to run `cargo semver-checks` on." -runs: - using: "composite" - steps: - - run: wget -q -O- https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.22.1/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.cargo/bin - shell: bash - - - name: Get released version - shell: bash - id: get-released-version - run: | - MAX_STABLE_VERSION=$(curl https://crates.io/api/v1/crates/${{ inputs.crate }} --silent | jq '.crate.max_stable_version') - echo "version=${MAX_STABLE_VERSION}" >> $GITHUB_OUTPUT - - - shell: bash - run: | - rustc --version | tee .rustc-version - cargo semver-checks --version | tee .semver-checks-version - - - uses: actions/cache@v3 - with: - path: ${{ github.workspace }}/target/semver-checks/cache - key: semver-checks-cache-${{ hashFiles('.rustc-version') }}-${{ hashFiles('.semver-checks-version') }}-${{ inputs.crate }}-${{ steps.get-released-version.outputs.version }} - - - run: cargo semver-checks check-release --package ${{ inputs.crate }} --verbose - shell: bash - env: - CARGO_TERM_VERBOSE: "true" - # debugging https://github.com/libp2p/rust-libp2p/pull/3782#issuecomment-1523346255 - CARGO_HTTP_DEBUG: "true" - CARGO_LOG: "cargo::ops::registry=debug" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2a6651d..6a0e7001 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,20 +49,6 @@ jobs: - name: Check if we compile without any features activated run: cargo build --package "$CRATE" --no-default-features - - run: cargo clean - - - name: Check if crate has been released - id: check-released - run: | - RESPONSE_CODE=$(curl https://crates.io/api/v1/crates/"$CRATE" --silent --write-out "%{http_code}" --output /dev/null) - echo "code=${RESPONSE_CODE}" - echo "code=${RESPONSE_CODE}" >> $GITHUB_OUTPUT - - - uses: ./.github/actions/cargo-semver-checks - if: steps.check-released.outputs.code == 200 && !contains(fromJSON('["libp2p-swarm-derive", "libp2p-server"]'), env.CRATE) # Workaround until https://github.com/obi1kenobi/cargo-semver-check/issues/146 is shipped. - with: - crate: ${{ env.CRATE }} - - name: Enforce no dependency on meta crate if: env.CRATE != 'libp2p-server' run: | @@ -273,6 +259,14 @@ jobs: cargo check --manifest-path "$toml"; done + semver: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: wget -q -O- https://github.com/obi1kenobi/cargo-semver-checks/releases/download/v0.22.1/cargo-semver-checks-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.cargo/bin + shell: bash + - uses: obi1kenobi/cargo-semver-checks-action@v2 + rustfmt: runs-on: ubuntu-latest steps: