Skip to content

Commit

Permalink
ci: install cargo-hack from GitHub release instead of using cache (#1100
Browse files Browse the repository at this point in the history
)

## Motivation

Closes #648

## Solution

Install cargo-hack from GitHub release instead of using cache.
See also taiki-e/cargo-hack#89 and 
taiki-e/cargo-hack#91.
  • Loading branch information
taiki-e authored Nov 13, 2020
1 parent 3ea53c6 commit fa105b6
Showing 1 changed file with 2 additions and 33 deletions.
35 changes: 2 additions & 33 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,7 @@ jobs:
command: check
args: --all --bins --examples --tests --benches

cache-cargo-hack:
runs-on: ubuntu-latest
steps:
- name: Fetch latest release version of cargo-hack
run: |
mkdir -p .github/caching
curl -sL https://api.github.com/repos/taiki-e/cargo-hack/releases/latest | jq -r '.name' > .github/caching/cargo-hack.lock
- name: Cache cargo-hack/bin
id: cache-cargo-hack
uses: actions/cache@v1
with:
path: ${{ runner.tool_cache }}/cargo-hack/bin
key: cargo-hack-bin-${{ hashFiles('.github/caching/cargo-hack.lock') }}
- name: Install cargo-hack
if: "steps.cache-cargo-hack.outputs.cache-hit != 'true'"
uses: actions-rs/cargo@v1
with:
command: install
args: --root ${{ runner.tool_cache }}/cargo-hack --force cargo-hack

cargo-hack:
needs: cache-cargo-hack
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -73,19 +52,9 @@ jobs:
toolchain: stable
profile: minimal
override: true
- name: Fetch latest release version of cargo-hack
- name: Install cargo-hack
run: |
mkdir -p .github/caching
curl -sL https://api.github.com/repos/taiki-e/cargo-hack/releases/latest | jq -r '.name' > .github/caching/cargo-hack.lock
- name: Restore cargo-hack/bin
uses: actions/cache@v1
with:
path: ${{ runner.tool_cache }}/cargo-hack/bin
key: cargo-hack-bin-${{ hashFiles('.github/caching/cargo-hack.lock') }}
- run: echo "${{ runner.tool_cache }}/cargo-hack/bin" >> $GITHUB_PATH
# if `cargo-hack` somehow doesn't exist after loading it from the cache,
# make *sure* it's there.
- run: cargo hack --help || { cargo install --force cargo-hack; }
curl -LsSf https://github.com/taiki-e/cargo-hack/releases/latest/download/cargo-hack-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- name: cargo hack check
working-directory: ${{ matrix.subcrate }}
run: cargo hack check --feature-powerset --no-dev-deps
Expand Down

0 comments on commit fa105b6

Please sign in to comment.