ci: staking-miner-playground check only if changed #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Polkadot Staking Miner Playground CI | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'staking-miner-playground/**' | |
env: | |
IMAGE: paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v20240408 | |
IMAGE_NAME: paritytech/polkadot-staking-miner | |
RUST_INFO: rustup show && cargo --version && rustup +nightly show && cargo +nightly --version | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
set-image: | |
# GitHub Actions does not allow using 'env' in a container context. | |
# This workaround sets the container image for each job using 'set-image' job output. | |
runs-on: ubuntu-latest | |
outputs: | |
IMAGE: ${{ steps.set_image.outputs.IMAGE }} | |
steps: | |
- id: set_image | |
run: echo "IMAGE=${{ env.IMAGE }}" >> $GITHUB_OUTPUT | |
check: | |
name: Check staking-miner-playground | |
runs-on: ubuntu-latest | |
needs: [set-image] | |
container: ${{ needs.set-image.outputs.IMAGE }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache Rust dependencies | |
uses: swatinem/rust-cache@v2 | |
with: | |
key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} | |
- name: Check staking-miner-playground | |
run: | | |
${{ env.RUST_INFO }} | |
cargo check --manifest-path staking-miner-playground/Cargo.toml |