ci: Deploy pages #109
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: Check codebase | |
on: | |
pull_request: | |
push: | |
branches: | |
- develop | |
- master | |
- 'refs/tags/[0-9]+.[0-9]+.[0-9]+*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
get-commit-head: | |
name: Get HEAD commit message | |
runs-on: ubuntu-latest | |
outputs: | |
headCommitMsg: ${{ steps.get-head-commit-message.outputs.headCommitMsg }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# We use different payloads depending on whether this is a `push` or a `pull_request` event | |
ref: ${{ github.event.head_commit.id || github.event.pull_request.head.sha }} | |
- name: Get HEAD commit message | |
id: get-head-commit-message | |
run: echo "headCommitMsg=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" | |
cargo-clippy: | |
name: Run Clippy checks | |
runs-on: ubuntu-latest | |
needs: get-commit-head | |
if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} | |
strategy: | |
matrix: | |
features: | |
- | |
- --all-features | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- name: Set up Cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run `cargo clippy` | |
run: | | |
docker run --rm \ | |
-v "${GITHUB_WORKSPACE}:/workspace" \ | |
-v "${HOME}/.cargo:/root/.cargo" \ | |
-w /workspace \ | |
-e SKIP_WASM_BUILD=1 \ | |
paritytech/ci-unified:bullseye-1.74.0 \ | |
bash -c "cargo clippy --all-targets --locked ${{ matrix.features }} -- -D warnings" | |
cargo-fmt: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
container: | |
image: paritytech/ci-unified:bullseye-1.74.0 | |
env: | |
RUSTUP_NIGHTLY_VERSION: nightly-2023-10-02 | |
needs: get-commit-head | |
if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-rust') }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install nightly toolchain | |
run: rustup toolchain add ${{ env.RUSTUP_NIGHTLY_VERSION }} | |
- name: Run `cargo fmt` | |
# Latest nightly version matching the base rustc version (1.74.0) | |
run: cargo +${{ env.RUSTUP_NIGHTLY_VERSION }} fmt -- --check | |
- name: Run `taplo` | |
run: taplo fmt --check | |
integration-tests: | |
name: Run Chopsticks tests | |
runs-on: ubuntu-latest | |
env: | |
working-dir: ./integration-tests/chopsticks | |
CI: true | |
PEREGRINE_WASM_OVERRIDE: ../../target/debug/wbuild/peregrine-runtime/peregrine_runtime.wasm | |
defaults: | |
run: | |
working-directory: ${{ env.working-dir }} | |
needs: | |
- get-commit-head | |
if: ${{ !contains(needs.get-commit-head.outputs.headCommitMsg, 'ci-skip-integration-tests') }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- name: Setup environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "${{ env.working-dir }}/.nvmrc" | |
- name: Install dependencies | |
run: yarn --immutable | |
- name: Check TS | |
run: yarn ts-check | |
- name: Check lints | |
run: yarn lint | |
- name: Set up Cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build Peregrine runtime | |
run: cargo build -p peregrine-runtime | |
- name: Run Chopsticks tests | |
run: yarn test:CI | |
cargo-test: | |
name: Run Cargo tests | |
runs-on: ubuntu-latest | |
needs: cargo-clippy | |
strategy: | |
matrix: | |
features: | |
- | |
- --all-features | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- name: Set up Cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ github.job }}-${{ github.ref }}-${{ matrix.features }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run `cargo test` | |
run: | | |
docker run --rm \ | |
-v "${GITHUB_WORKSPACE}:/workspace" \ | |
-v "${HOME}/.cargo:/root/.cargo" \ | |
-w /workspace \ | |
paritytech/ci-unified:bullseye-1.74.0 \ | |
bash -c "cargo test --all-targets --locked ${{ matrix.features }}" | |
cargo-doc: | |
name: Check Rustdoc | |
runs-on: ubuntu-latest | |
needs: cargo-clippy | |
strategy: | |
matrix: | |
features: | |
- | |
- --all-features | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- name: Set up Cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Run `cargo doc` | |
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 doc --no-deps --locked ${{ matrix.features }}" | |
try-runtime: | |
name: Run try-runtime | |
runs-on: ubuntu-latest | |
needs: cargo-clippy | |
env: | |
TRY_RUNTIME_CLI_VERSION_TAG: v0.7.0 | |
container: | |
image: paritytech/ci-unified:bullseye-1.74.0 | |
strategy: | |
matrix: | |
runtime: | |
- peregrine | |
- spiritnet | |
fail-fast: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
- name: Install try-runtime | |
run: | | |
curl -sL /~https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_CLI_VERSION_TAG }}/try-runtime-x86_64-unknown-linux-musl -o try-runtime | |
chmod +x ./try-runtime | |
./try-runtime --version | |
- name: Set up Cargo cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
key: ${{ github.job }}-${{ github.ref }}-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build runtime | |
run: cargo build --release --locked -p ${{ matrix.runtime }}-runtime --features try-runtime | |
- name: Run `try-runtime` | |
run: | | |
./try-runtime \ | |
--runtime=./target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm \ | |
on-runtime-upgrade \ | |
--disable-spec-version-check \ | |
--checks=all \ | |
live \ | |
--uri=wss://${{ matrix.runtime }}.kilt.io |