Skip to content

Commit

Permalink
Attempt to use prebuilt binary.
Browse files Browse the repository at this point in the history
  • Loading branch information
obi1kenobi committed Feb 23, 2023
1 parent f28b414 commit 0adbe66
Showing 1 changed file with 41 additions and 7 deletions.
48 changes: 41 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,40 @@ jobs:
cd semver
cargo test
- name: build
build-binary:
name: Build binary
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
path: 'semver'

- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- uses: Swatinem/rust-cache@v2
with:
shared-key: 'semver'
workspaces: 'semver'

- name: build and cache
run: |
cd semver
cargo build
mkdir ../bins
mv target/debug/cargo-semver-checks ../bins/cargo-semver-checks
- name: cache binary
uses: actions/cache/save@v3
with:
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}

run-on-rust-libp2p:
# Run cargo-semver-checks on a crate with no semver violations,
Expand All @@ -131,6 +161,8 @@ jobs:
# https://github.com/obi1kenobi/cargo-semver-check/issues/147
name: Run cargo-semver-checks on rust-libp2p 0.47.0
runs-on: ubuntu-latest
needs:
- build-binary
steps:
- name: Checkout cargo-semver-checks
uses: actions/checkout@v3
Expand All @@ -157,11 +189,13 @@ jobs:
- name: Install protobuf-compiler
run: sudo apt install protobuf-compiler

- uses: Swatinem/rust-cache@v2
- name: Restore binary
id: cache-binary
uses: actions/cache/restore@v3
with:
shared-key: 'semver'
workspaces: 'semver'
save-if: false
path: bins/
key: bins-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
fail-on-cache-miss: true

- shell: bash
run: |
Expand All @@ -177,15 +211,15 @@ jobs:
- name: Run semver-checks
run: |
cd semver
cargo run semver-checks check-release --manifest-path="../subject/core/Cargo.toml"
../bins/cargo-semver-checks check-release --manifest-path="../subject/core/Cargo.toml"
# Test passing package name explicitly.
# It was previously possible to make the command above work while the one here failed.
# Reference: https://github.com/obi1kenobi/cargo-semver-checks/issues/174
- name: Run semver-checks (alternative command)
run: |
cd semver
cargo run semver-checks check-release --manifest-path="../subject/core/Cargo.toml" --package="libp2p-core"
../bins/cargo-semver-checks check-release --manifest-path="../subject/core/Cargo.toml" --package="libp2p-core"
- name: Save rustdoc
uses: actions/cache/save@v3
Expand Down

0 comments on commit 0adbe66

Please # to comment.