Skip to content

Commit

Permalink
--wip-- [with ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Mar 3, 2023
1 parent b1e1512 commit 3ed6cf6
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/actions/setup-cargo-codspeed/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Setup cargo-codspeed'
description: 'Install cargo-codspeed using cache if possible'
inputs:
version:
description: "Version to install"
required: true
default: '1.1.0'

outputs:
cache-hit:
description: "Was the cache hit"
value: ${{ steps.cache.outputs.cache-hit }}

runs:
using: "composite"
steps:
- name: Cache cargo-codspeed
id: cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/cargo-codspeed
key: cargo-codspeed-${{ inputs.version }}
- name: Install cargo-codspeed specific version
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install cargo-codspeed --version ${{ inputs.version }}
shell: bash
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,30 @@ jobs:
with:
run: cargo codspeed run
token: ${{ secrets.CODSPEED_TOKEN }}

setup-cargo-codspeed-action-cache-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: ./.github/actions/setup-cargo-codspeed

test-setup-cargo-codspeed-action-cache-hit:
needs: setup-cargo-codspeed-action-cache-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: ./.github/actions/setup-cargo-codspeed
id: setup-cargo-codspeed-again
- name: Check that the second install hit the cache
run: |
echo "Cache hit: ${{ steps.setup-cargo-codspeed-again.outputs.cache-hit }}"
if [ "${{ steps.setup-cargo-codspeed-again.outputs.cache-hit }}" != "true" ]; then
echo "Cache was not hit"
exit 1
fi

0 comments on commit 3ed6cf6

Please # to comment.