Skip to content

ci: Migrate Gitlab tests to GitHub runner #7

ci: Migrate Gitlab tests to GitHub runner

ci: Migrate Gitlab tests to GitHub runner #7

Workflow file for this run

name: Cargo Tests
on:
pull_request:
push:
branches:
- develop
- master
- 'refs/tags/[0-9]+.[0-9]+.[0-9]+*'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
features: ["", "--all-features"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Get Head Commit Message
id: step-head-commit
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT"
- name: Free Disk Space
if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }}
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Set up Cargo Cache
if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }}
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ github.ref_name }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ github.job }}-${{ github.ref_name }}-${{ matrix.features }}-
- name: Run Tests
if: ${{ !contains(steps.step-head-commit.outputs.headCommitMsg, 'ci-skip-rust') }}
run: |
docker run --rm \
-v "${GITHUB_WORKSPACE}:/workspace" \
-v "${HOME}/.cargo:/root/.cargo" \
-w /workspace \
-e RUSTDOCFLAGS='-D warnings' \
-e SKIP_WASM_BUILD=1 \
paritytech/ci-unified:bullseye-1.74.0 \
bash -c "cargo test --all-targets --locked ${{ matrix.features }}"