Upgrade to upstream 0.9.40 #1846
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: Test rust code | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
env: | |
nightly: nightly-2023-03-08 | |
target: wasm32-unknown-unknown | |
try-runtime-chain: dev | |
try-runtime-uri: wss://eden-rpc.dwellir.com:443 | |
jobs: | |
lints: | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.nightly }} | |
components: rustfmt, clippy | |
target: ${{ env.target }} | |
- name: Rustfmt Check | |
uses: actions-rust-lang/rustfmt@v1 | |
- name: Install protobuf-compiler | |
run: | | |
sudo apt-get install protobuf-compiler | |
- name: Clippy | |
uses: actions-rs-plus/clippy-check@v2 | |
with: | |
args: --all-features -- -A clippy::type_complexity -A clippy::identity_op -A clippy::boxed_local -D dead_code | |
toolchain: ${{ env.nightly }} | |
tests: | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.nightly }} | |
target: ${{ env.target }} | |
- name: Install protobuf-compiler | |
run: | | |
sudo apt-get install protobuf-compiler | |
- name: Cache cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache cargo index | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-index- | |
- name: Cache cargo build | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build-target- | |
- name: Build | |
run: cargo build --release --bin nodle-parachain | |
- name: Unit tests | |
run: cargo test --all-features | |
linecoverage: | |
runs-on: ubuntu-latest-4-cores | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.nightly }} | |
target: ${{ env.target }} | |
- name: Install protobuf-compiler | |
run: | | |
sudo apt-get install protobuf-compiler | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Test and gather coverage | |
run: cargo llvm-cov --lcov --output-path lcov.info --all-features --workspace --exclude nodle-parachain | |
- name: Upload to Codecov | |
uses: codecov/codecov-action@v3.0.0 | |
with: | |
fail_ci_if_error: false | |
files: lcov.info | |
try-runtime: | |
runs-on: ubuntu-latest-8-cores | |
timeout-minutes: 50 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check Version | |
run: | | |
echo -n "eden_rev=" >> $GITHUB_OUTPUT | |
curl -s --request POST --url https://nodle-parachain.api.onfinality.io/public --header 'Content-Type: application/json' --data '{ | |
"jsonrpc": "2.0", | |
"method": "system_version", | |
"params": [], | |
"id": 1 | |
}' | jq '{"result"}[]' >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
id: get_version | |
- name: Install protobuf-compiler | |
run: | | |
sudo apt-get install protobuf-compiler | |
- name: Install Rust nightly | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.nightly }} | |
target: ${{ env.target }} | |
- name: Cache a dir | |
uses: actions/cache@v3 | |
id: cachedir | |
with: | |
path: snapshots | |
key: ${{steps.get_version.outputs.eden_rev}} | |
- name: Cargo build | |
run: cargo build --release --features=try-runtime --bin nodle-parachain | |
- name: Fetch snapshot | |
if: steps.cachedir.outputs.cache-hit != 'true' | |
continue-on-error: true | |
run: | | |
install -d snapshots | |
date > snapshots/created_at | |
./target/release/nodle-parachain try-runtime --runtime existing -lruntime=debug --chain ${{ env.try-runtime-chain }} create-snapshot "snapshots/eden-snapshot-full" -u ${{ env.try-runtime-uri}} | |
- name: Run Migration on new snapshot | |
if: steps.cachedir.outputs.cache-hit != 'true' | |
run: | | |
./target/release/nodle-parachain try-runtime --runtime target/release/wbuild/runtime-eden/runtime_eden.wasm -lruntime=debug --chain ${{ env.try-runtime-chain }} on-runtime-upgrade --checks=all snap -s snapshots/eden-snapshot-full | |
- name: Try runtime reuse snap | |
if: steps.cachedir.outputs.cache-hit == 'true' | |
run: | | |
cat snapshots/created_at | |
./target/release/nodle-parachain try-runtime --runtime target/release/wbuild/runtime-eden/runtime_eden.wasm --chain ${{ env.try-runtime-chain }} on-runtime-upgrade --checks=all snap --snapshot-path="snapshots/eden-snapshot-full" |