Merge pull request #14 from paritytech/common-base #23
This file contains hidden or 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: CI | |
| # Controls when the action will run. | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Cancel previous runs | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| # Parity CI image to use | |
| # Common variable is defined in the workflow | |
| # Repo env variable doesn't work for PRs from forks | |
| env: | |
| CI_IMAGE: "paritytech/ci-unified:bullseye-1.84.1-2025-01-28-v202502131220" | |
| jobs: | |
| set-image: | |
| # This workaround sets the container image for each job using 'set-image' job output. | |
| # env variables don't work for PRs from forks, so we need to use outputs. | |
| runs-on: ubuntu-latest | |
| outputs: | |
| CI_IMAGE: ${{ steps.set_image.outputs.CI_IMAGE }} | |
| steps: | |
| - id: set_image | |
| run: echo "CI_IMAGE=${{ env.CI_IMAGE }}" >> $GITHUB_OUTPUT | |
| check: | |
| name: Cargo check | |
| runs-on: ubuntu-latest | |
| needs: [set-image] | |
| container: | |
| image: ${{ needs.set-image.outputs.CI_IMAGE }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Install Rust stable toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| profile: minimal | |
| toolchain: stable | |
| override: true | |
| # Rust cache | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| cache-all-crates: true | |
| - name: Cargo check | |
| run: | | |
| SKIP_WASM_BUILD=1 cargo check | |
| check-benchmarking: | |
| name: Cargo check (benchmarking) | |
| runs-on: ubuntu-latest | |
| needs: [set-image] | |
| container: | |
| image: ${{ needs.set-image.outputs.CI_IMAGE }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| # Rust cache | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| cache-all-crates: true | |
| - name: Cargo check (benchmarking) | |
| run: > | |
| cd node && | |
| cargo check --features=runtime-benchmarks |