Specify prod chain URL with names and check for the verifiable build upon upload #1570
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: ci | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
paths-ignore: | |
- 'README.md' | |
- 'CHANGELOG.md' | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
default: true | |
components: rustfmt | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check Formatting | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --check | |
# Runs `cargo check` on each individual crate in the `crates` directory. | |
# | |
# This is required because the other commands build on the workspace level, | |
# or bring in `dev-dependencies` via the `test` target and it is possible | |
# for a crate to compile successfully in those cases, but fail when compiled | |
# on its own. | |
# | |
# Specifically, this happens where a dependency is missing features, but | |
# when building as part of the workspace or together with a `dev-dependency` | |
# those features are brought in via feature unification with another | |
# crate. | |
# | |
# When publishing, `cargo publish` will run a `check` on the individual | |
# crate being released. So this check is intended to catch any errors that | |
# may occur there, but otherwise would not be caught by the `test` and | |
# `clippy` commands which operate on the workspace and enable all targets. | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check each crate | |
run: | | |
for crate in ./crates/*/; do | |
echo "Checking $crate"; | |
cargo check --manifest-path ${crate}/Cargo.toml; | |
done | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
components: clippy | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Check permissions of GITHUB_TOKEN, workaround for permission issues | |
# with @dependabot PRs. See https://github.com/actions-rs/clippy-check/issues/2#issuecomment-807878478 | |
- name: Check workflow permissions | |
id: check_permissions | |
uses: scherermichael-oss/[email protected] | |
with: | |
required-permission: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clippy with features | |
uses: actions-rs/clippy-check@v1 | |
if: ${{ steps.check_permissions.outputs.has-permission }} | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --profile debug-ci --all-features --all-targets -- -D warnings | |
- name: Clippy without features | |
if: ${{ steps.check_permissions.outputs.has-permission }} | |
uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --profile debug-ci --all-targets -- -D warnings | |
# Runs if the GITHUB_TOKEN does not have `write` permissions e.g. @dependabot | |
- name: Clippy with features (no annotations) | |
if: ${{ !steps.check_permissions.outputs.has-permission }} | |
run: cargo clippy --profile debug-ci --all-features --all-targets -- -D warnings | |
# Runs if the GITHUB_TOKEN does not have `write` permissions e.g. @dependabot | |
- name: Clippy without features (no annotations) | |
if: ${{ !steps.check_permissions.outputs.has-permission }} | |
run: cargo clippy --profile debug-ci --all-targets -- -D warnings | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
# We want newer versions than 'latest' here to have current wasm-opt | |
os: ["ubuntu-22.04", "macos-12"] | |
runs-on: ${{ matrix.os }} | |
env: | |
RUST_BACKTRACE: full | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
target: wasm32-unknown-unknown | |
components: rust-src, clippy | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Install latest `substrate-contracts-node` binary | |
env: | |
CONTRACTS_NODE_URL: https://gitlab.parity.io/parity/mirrors/substrate-contracts-node/-/jobs/artifacts/main/download | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
CONTRACTS_NODE_OS=linux | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
CONTRACTS_NODE_OS=mac | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi | |
curl -L -o substrate-contracts-node.zip "$CONTRACTS_NODE_URL?job=build-$CONTRACTS_NODE_OS" | |
unzip substrate-contracts-node.zip | |
chmod +x artifacts/substrate-contracts-node-$CONTRACTS_NODE_OS/substrate-contracts-node && | |
mv artifacts/substrate-contracts-node-$CONTRACTS_NODE_OS/substrate-contracts-node /usr/local/bin | |
shell: bash | |
- name: Run tests | |
run: cargo test --profile debug-ci --all-features -- --test-threads=1 | |
template: | |
strategy: | |
fail-fast: false | |
matrix: | |
# We want newer versions than 'latest' here to have current wasm-opt | |
os: ["ubuntu-22.04", "macos-12", "windows-2022"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
default: true | |
target: wasm32-unknown-unknown | |
components: rust-src, clippy | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Check Template | |
run: >- | |
cargo -vV && | |
cargo run --profile debug-ci -- contract --version && | |
cargo run --profile debug-ci -- contract new --target-dir ${{ runner.temp }} foobar && | |
cargo run --profile debug-ci -- contract build --manifest-path=${{ runner.temp }}/foobar/Cargo.toml && | |
cargo run --profile debug-ci -- contract check --manifest-path=${{ runner.temp }}/foobar/Cargo.toml && | |
cargo run --profile debug-ci -- contract build --manifest-path=${{ runner.temp }}/foobar/Cargo.toml --release |