Skip to content

Conditionally compiled PoT support #1705

Conditionally compiled PoT support

Conditionally compiled PoT support #1705

Workflow file for this run

name: Rust
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- '.github/CODEOWNERS'
pull_request:
paths-ignore:
- '**.md'
- '.github/CODEOWNERS'
workflow_dispatch:
inputs:
test-macos:
description: 'Whether to run macOS tests'
required: true
default: false
type: boolean
concurrency:
group: rust-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Not needed in CI, should make things a bit faster
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
# Build smaller artifacts to avoid running out of space in CI
# TODO: Try to remove once https://github.com/paritytech/substrate/issues/11538 is resolved
# TODO: AES flag is such that we have decent performance on ARMv8, remove once `aes` crate bumps MSRV to at least
# 1.61: https://github.com/RustCrypto/block-ciphers/issues/373
RUSTFLAGS: -C strip=symbols -C opt-level=s --cfg aes_armv8
# Remove unnecessary WASM build artefacts
WASM_BUILD_CLEAN_TARGET: 1
jobs:
cargo-fmt:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
- name: Install Protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # @v1.1.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure cache
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # @v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: cargo fmt
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1
with:
command: fmt
args: --all -- --check
cargo-clippy:
strategy:
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
# On macOS, we need a proper Clang version, not Apple's custom version without wasm32 support
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@8852e4d5c58653ed05135c0a5d949d9c2febcb00 # v1.6.1
with:
version: "15.0"
if: runner.os == 'macOS'
- name: Install Protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # @v1.1.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
- name: Remove msys64
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
if: runner.os == 'Windows'
- name: Configure cache
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # @v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: cargo clippy
uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d # @v1.0.7
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --locked --all-targets -- -D warnings
cargo-docs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
- name: Install Protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # @v1.1.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure cache
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # @v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: Check Documentation
run: cargo doc --locked --all --no-deps --lib
env:
RUSTDOCFLAGS: "-D rustdoc::broken-intra-doc-links -D rustdoc::private_intra_doc_links"
cargo-test:
strategy:
matrix:
os:
- ubuntu-22.04
- macos-12
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0
# On macOS, we need a proper Clang version, not Apple's custom version without wasm32 support
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@8852e4d5c58653ed05135c0a5d949d9c2febcb00 # v1.6.1
with:
version: "15.0"
if: runner.os == 'macOS'
- name: Install Protoc
uses: arduino/setup-protoc@64c0c85d18e984422218383b81c52f8b077404d3 # @v1.1.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
- name: Remove msys64
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
if: runner.os == 'Windows'
- name: Configure cache
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # @v3.0.11
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}
- name: cargo test --locked
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # @v1.0.1
with:
command: test
if: runner.os != 'macOS' || inputs.test-macos == true || github.ref == 'refs/heads/main'