Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: cargo codspeed setup action #3

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
38 changes: 38 additions & 0 deletions .github/workflows/check-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Check setup-cargo-codspeed action
on:
push:
branches: [main]
pull_request:
branches: [main]

concurrency:
group: ${{ github.ref }}-check-action
cancel-in-progress: true

jobs:
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