[Do not merge] Only run CI #2231
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: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
try-runtime-chain: dev | |
try-runtime-uri: wss://eden-rpc.dwellir.com:443/ | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
RUSTFLAGS: "" | |
jobs: | |
lints: | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.toolchain }} | |
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.toolchain }} | |
tests: | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.toolchain }} | |
target: ${{ env.target }} | |
- name: Install protobuf-compiler | |
run: | | |
sudo apt-get install protobuf-compiler | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
- name: Unit tests | |
run: cargo test --all-features | |
linecoverage: | |
runs-on: ubuntu-latest-4-cores | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.toolchain }} | |
target: ${{ env.target }} | |
- name: Install protobuf-compiler | |
run: | | |
sudo apt-get install protobuf-compiler | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
- 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/[email protected] | |
with: | |
fail_ci_if_error: false | |
files: lcov.info | |
try-runtime-prepare: | |
runs-on: ubuntu-latest-8-cores | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install protobuf-compiler | |
run: | | |
sudo apt-get install protobuf-compiler | |
- name: Install Rust stable | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: ${{ env.toolchain }} | |
target: ${{ env.target }} | |
- name: Setup sccache | |
uses: mozilla-actions/[email protected] | |
- name: Build runtime | |
run: cargo build --release --features=try-runtime -p runtime-eden | |
- name: Upload runtime artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: try_runtime | |
path: target/release/wbuild/runtime-eden/runtime_eden.wasm | |
try-runtime-execute: | |
runs-on: ubuntu-latest | |
needs: try-runtime-prepare | |
steps: | |
- name: Download runtime artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: try_runtime | |
path: try_runtime | |
- 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": "state_getRuntimeVersion", | |
"params": [], | |
"id": 1 | |
}' | jq .result.specVersion | sed 's/^/try-runtime-snapshot-eden-spec-/' >> $GITHUB_OUTPUT | |
cat $GITHUB_OUTPUT | |
id: get_version | |
- name: Setup cache | |
uses: actions/cache@v3 | |
id: cachedir | |
with: | |
path: snapshots | |
key: ${{steps.get_version.outputs.eden_rev}} | |
- name: Ensure cache directory is created | |
if: steps.cachedir.outputs.cache-hit != 'true' | |
run: | | |
install -d snapshots | |
date > snapshots/created_at | |
- name: Run try-runtime | |
uses: NodleCode/action-try-runtime@dev | |
with: | |
url: ${{ env.try-runtime-uri}}${{ secrets.DWELLIR_API_KEY}} | |
snap: snapshots/eden-snapshot-full | |
runtime: try_runtime/runtime_eden.wasm | |
checks: "all" | |
options: "--no-idempotency-checks" | |
- name: Upload snap artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: edensnap | |
path: snapshots/eden-snapshot-full |