ethereum: added e2e tests #6267
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Verify PR Commit | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref}} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
branches: | |
- main | |
- "*-development" # Feature Branches should suffix with -development | |
env: | |
BIN_DIR: target/release | |
PR_LABEL_METADATA_CHANGED: metadata-changed | |
PR_LABEL_METADATA_VERSION_NOT_INCREMENTED: metadata-version-not-incremented | |
jobs: | |
changes: | |
name: Determine Changed Files | |
runs-on: ubuntu-22.04 | |
outputs: | |
rust: ${{steps.filter.outputs.rust}} | |
build-binary: ${{steps.filter.outputs.build-binary}} | |
cargo-lock: ${{steps.filter.outputs.cargo-lock}} | |
run-e2e: ${{steps.filter.outputs.run-e2e}} | |
ci-docker-image: ${{steps.filter.outputs.ci-docker-image}} | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Check for Changed Files | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 | |
id: filter | |
with: | |
filters: | | |
rust: | |
- '**/*.rs' | |
- '**/*.hbs' | |
- '.rustfmt.toml' | |
- '**/Cargo.toml' | |
- '**/Cargo.lock' | |
build-binary: | |
- '**/*.rs' | |
- '**/*.hbs' | |
- '.rustfmt.toml' | |
- '**/Cargo.toml' | |
- '**/Cargo.lock' | |
- 'js/api-augment/**' | |
- 'e2e/**/*.{ts,json}' | |
cargo-lock: | |
- '**/Cargo.toml' | |
- '**/Cargo.lock' | |
run-e2e: | |
- '**/*.rs' | |
- '**/Cargo.toml' | |
- 'e2e/**/*.{ts,json}' | |
clear-metadata-labels: | |
name: Clear Metadata Labels | |
runs-on: ubuntu-22.04 | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Clear Metadata Changed Label | |
if: contains(github.event.pull_request.labels.*.name, env.PR_LABEL_METADATA_CHANGED) | |
uses: RobinJesba/GitHub-Labeler-Action@2f69380bbf2ee60b2f0893ef0f40582c9a34a64d | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
LABELS_TO_REMOVE: ${{env.PR_LABEL_METADATA_CHANGED}} | |
- name: Clear Metadata Version Not Incremented Label | |
if: contains(github.event.pull_request.labels.*.name, env.PR_LABEL_METADATA_VERSION_NOT_INCREMENTED) | |
uses: RobinJesba/GitHub-Labeler-Action@2f69380bbf2ee60b2f0893ef0f40582c9a34a64d | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
LABELS_TO_REMOVE: ${{env.PR_LABEL_METADATA_VERSION_NOT_INCREMENTED}} | |
# Workaround to handle skipped required check inside matrix | |
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks | |
build-binaries-dummy: | |
needs: changes | |
if: needs.changes.outputs.build-binary != 'true' | |
runs-on: ubuntu-22.04 | |
name: Build ${{matrix.network}} Binary on ${{matrix.branch_alias}} Branch | |
strategy: | |
matrix: | |
# Match this to the real build-binaries job | |
include: | |
- network: dev | |
git_branch: ${{github.head_ref}} | |
spec: frequency-no-relay | |
branch_alias: pr | |
- network: local | |
git_branch: ${{github.head_ref}} | |
spec: frequency-local | |
branch_alias: pr | |
- network: local | |
git_branch: main | |
spec: frequency-local | |
branch_alias: main | |
- network: testnet | |
spec: frequency-testnet | |
branch_alias: pr | |
- network: mainnet | |
spec: frequency | |
branch_alias: pr | |
steps: | |
- run: echo "Just a dummy matrix to satisfy GitHub required checks that were skipped" | |
build-binaries: | |
needs: changes | |
if: needs.changes.outputs.build-binary == 'true' | |
name: Build ${{matrix.network}} Binary on ${{matrix.branch_alias}} Branch | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- network: dev | |
git_branch: ${{github.head_ref}} | |
spec: frequency-no-relay | |
branch_alias: pr | |
- network: local | |
git_branch: ${{github.head_ref}} | |
spec: frequency-local | |
branch_alias: pr | |
- network: local | |
git_branch: main | |
spec: frequency-local | |
branch_alias: main | |
- network: testnet | |
spec: frequency-testnet | |
branch_alias: pr | |
- network: mainnet | |
spec: frequency | |
branch_alias: pr | |
runs-on: ubicloud-standard-16 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
env: | |
NETWORK: mainnet | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{matrix.git_branch}} | |
- name: Set Env Vars | |
run: | | |
export BUILT_BIN_FILENAME=frequency; echo "BUILT_BIN_FILENAME=$BUILT_BIN_FILENAME" >> $GITHUB_ENV | |
echo "FINAL_BIN_FILENAME=$BUILT_BIN_FILENAME.${{matrix.network}}.${{matrix.spec}}.${{matrix.branch_alias}}" >> $GITHUB_ENV | |
# # XXX Keep this step as it lets us skip full binary builds during development/testing | |
# - name: Cache Binary for Testing | |
# id: cache-binary | |
# uses: actions/cache@v3 | |
# with: | |
# path: ${{env.BIN_DIR}}/${{env.FINAL_BIN_FILENAME}} | |
# key: binaries-${{runner.os}}-${{env.NETWORK}}-${{github.head_ref}} | |
- name: Compile Binary | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
run: | | |
CARGO_INCREMENTAL=0 RUSTFLAGS="-D warnings" cargo build --locked --release \ | |
--features ${{matrix.spec}} | |
- name: Run Sanity Checks | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
file ${{env.BUILT_BIN_FILENAME}} && \ | |
./${{env.BUILT_BIN_FILENAME}} --version | |
- name: Rename Reference Binary | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
working-directory: ${{env.BIN_DIR}} | |
run: cp ${{env.BUILT_BIN_FILENAME}} ${{env.FINAL_BIN_FILENAME}} | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-binary-${{matrix.network}}-${{matrix.branch_alias}}-${{github.run_id}} | |
path: ${{env.BIN_DIR}}/${{env.FINAL_BIN_FILENAME}}* | |
if-no-files-found: error | |
check-for-vulnerable-crates: | |
needs: changes | |
if: needs.changes.outputs.cargo-lock == 'true' | |
name: Check for Vulnerable Crates | |
runs-on: ubuntu-22.04 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Set Up Cargo Deny | |
run: | | |
cargo install --force --locked cargo-deny | |
cargo generate-lockfile | |
- name: Run Cargo Deny | |
run: cargo deny check --hide-inclusion-graph -c deny.toml | |
verify-rust-code-format: | |
needs: changes | |
if: needs.changes.outputs.rust == 'true' | |
name: Verify Rust Code Format | |
runs-on: ubuntu-22.04 | |
container: | |
image: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repository | |
uses: actions/checkout@v4 | |
- name: Install Nightly Toolchain | |
run: | | |
rustup toolchain install nightly-2024-08-01 | |
- name: Install Rust Target | |
run: | | |
rustup target add wasm32-unknown-unknown --toolchain nightly-2024-08-01 | |
- name: Install Rust Source Component | |
run: | | |
rustup component add rust-src --toolchain nightly-2024-08-01 | |
- name: Verify Rust Code Formatting | |
run: | | |
cargo +nightly-2024-08-01 fmt --check | |
lint-rust-code: | |
needs: changes | |
if: needs.changes.outputs.rust == 'true' | |
name: Lint Rust Code | |
runs-on: ubicloud-standard-4 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Lint | |
run: | | |
SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy \ | |
--features runtime-benchmarks,frequency-lint-check \ | |
-- \ | |
-D warnings | |
verify-rust-developer-docs: | |
needs: changes | |
if: needs.changes.outputs.rust == 'true' | |
name: Verify Rust Developer Docs | |
runs-on: ubicloud-standard-4 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Build Docs | |
run: | | |
RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS="--enable-index-page --check -Zunstable-options" cargo doc --no-deps --workspace --features frequency | |
verify-rust-packages-and-deps: | |
needs: changes | |
if: needs.changes.outputs.rust == 'true' | |
name: Verify Rust Packages and Dependencies | |
runs-on: ubicloud-standard-4 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Check | |
run: SKIP_WASM_BUILD= cargo check --features runtime-benchmarks,frequency-lint-check | |
run-rust-tests: | |
needs: changes | |
if: needs.changes.outputs.rust == 'true' | |
name: Run Rust Tests | |
runs-on: ubicloud-standard-8 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Init Git | |
run: | | |
git config --global --add safe.directory /__w/frequency/frequency | |
- name: Run Tests | |
run: cargo test --features runtime-benchmarks,frequency-lint-check --workspace --release | |
calc-code-coverage: | |
needs: changes | |
if: needs.changes.outputs.rust == 'true' | |
name: Calculate Code Coverage | |
runs-on: ubicloud-standard-8 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Generate and Upload Code Coverage | |
id: codecov | |
uses: ./.github/workflows/common/codecov | |
with: | |
code-cov-token: ${{ secrets.CODECOV_TOKEN }} | |
# Workaround to handle skipped required check inside matrix | |
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks | |
verify-build-runtimes-dummy: | |
needs: changes | |
if: needs.changes.outputs.rust != 'true' | |
name: Verify Build Runtime for ${{matrix.network}} | |
strategy: | |
matrix: | |
# Should match `verify-build-runtimes` | |
network: [dev, paseo, mainnet] | |
runs-on: ubuntu-22.04 | |
steps: | |
- run: echo "Just a dummy matrix to satisfy GitHub required checks that were skipped" | |
verify-build-runtimes: | |
needs: changes | |
if: needs.changes.outputs.rust == 'true' | |
name: Verify Build Runtime for ${{matrix.network}} | |
strategy: | |
fail-fast: true | |
matrix: | |
# Remember, runtimes are separate for each relay chain | |
# We do not release frequency-*-local runtimes however | |
# Also should match `verify-build-runtimes-dummy` | |
network: [dev, paseo, mainnet] | |
include: | |
- network: dev | |
chain: dev | |
build-profile: release | |
package: frequency-runtime | |
runtime-dir: runtime/frequency | |
built-wasm-file-name-prefix: frequency_runtime | |
features: frequency-no-relay | |
wasm-core-version: frequency-testnet | |
- network: paseo | |
chain: frequency-paseo | |
build-profile: release | |
package: frequency-runtime | |
runtime-dir: runtime/frequency | |
built-wasm-file-name-prefix: frequency_runtime | |
features: frequency-testnet | |
wasm-core-version: frequency-testnet | |
- network: mainnet | |
chain: frequency | |
build-profile: release | |
package: frequency-runtime | |
runtime-dir: runtime/frequency | |
built-wasm-file-name-prefix: frequency_runtime | |
features: frequency | |
wasm-core-version: frequency | |
runs-on: ubicloud-standard-8 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
# Match installation steps to CI base docker image | |
run: | | |
curl https://sh.rustup.rs -sSf | bash -s -- -y | |
echo "PATH=$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV | |
- name: Extract Runtime Spec Version | |
run: | | |
echo "RUNTIME_SPEC_VERSION=$(awk '/spec_version:/ {match($0, /[0-9]+/); print substr($0, RSTART, RLENGTH); exit}' \ | |
${{matrix.runtime-dir}}/src/lib.rs)" >> $GITHUB_ENV | |
- name: Validate Extracted Version | |
shell: bash | |
run: | | |
echo "Runtime Spec Version: ${{env.RUNTIME_SPEC_VERSION}}" | |
[[ $RUNTIME_SPEC_VERSION == ?(-)+([0-9]) ]] || \ | |
(echo "ERROR: \"${{env.RUNTIME_SPEC_VERSION}}\" is not a valid integer" && exit 1) | |
- name: Set Env Vars | |
run: | | |
echo "WASM_DIR=${{matrix.runtime-dir}}/target/srtool/${{matrix.build-profile}}/wbuild/${{matrix.package}}" >> $GITHUB_ENV | |
echo "BUILT_WASM_FILENAME=${{matrix.built-wasm-file-name-prefix}}.compact.compressed.wasm" >> $GITHUB_ENV | |
# # XXX Keep this step as it lets us skip WASM builds during development/testing | |
# - name: Cache WASM for Testing | |
# id: cache-wasm | |
# uses: actions/cache@v3 | |
# with: | |
# path: ${{env.WASM_DIR}}/${{env.BUILT_WASM_FILENAME}} | |
# key: runtimes-${{runner.os}}-${{matrix.network}}-${{github.head_ref}} | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{secrets.DOCKERHUB_USERNAME}} | |
password: ${{secrets.DOCKERHUB_TOKEN}} | |
- name: Build Deterministic WASM | |
id: srtool_build | |
if: steps.cache-wasm.outputs.cache-hit != 'true' | |
uses: ./.github/workflows/common/srtool | |
env: | |
BUILD_OPTS: "--features on-chain-release-build,no-metadata-docs,${{matrix.features}}" | |
with: | |
profile: ${{matrix.build-profile}} | |
package: ${{matrix.package}} | |
chain: ${{matrix.chain}} | |
runtime_dir: ${{ matrix.runtime-dir }} | |
tag: "1.77.0" | |
- name: Check Deterministic WASM Build Exists | |
if: steps.cache-wasm.outputs.cache-hit != 'true' | |
run: | | |
file ${{ steps.srtool_build.outputs.wasm }} | |
- name: Install Subwasm | |
run: | | |
cargo install --locked --git https://github.com/chevdor/subwasm --tag v0.20.0 --force | |
subwasm --version | |
- name: Test WASM file | |
run: | | |
subwasm info ${{ steps.srtool_build.outputs.wasm }} | |
subwasm info ${{ steps.srtool_build.outputs.wasm }} | grep "Core version:.*${{matrix.wasm-core-version}}-${{env.RUNTIME_SPEC_VERSION}}" || \ | |
(echo "ERROR: WASM Core version didn't match ${{matrix.wasm-core-version}}-${{env.RUNTIME_SPEC_VERSION}}" && exit 1) | |
verify-js-api-augment: | |
needs: build-binaries | |
name: Verify JS API Augment | |
runs-on: ubuntu-22.04 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Set Env Vars | |
run: | | |
echo "BIN_FILENAME=frequency.local.frequency-local.pr" >> $GITHUB_ENV | |
- name: Set up NodeJs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: js/api-augment/package-lock.json | |
- name: Install Latest Versions | |
run: npm install # DO NOT use `npm ci` as we want the latest polkadot/api possible | |
working-directory: js/api-augment | |
- name: Lint | |
run: npm run lint | |
working-directory: js/api-augment | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-local-pr-${{github.run_id}} | |
path: ${{env.BIN_DIR}} | |
- name: Extract and List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Set Binary Permissions | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
chmod 755 ${{env.BIN_FILENAME}} | |
- name: Output Metadata | |
run: ${{env.BIN_DIR}}/${{env.BIN_FILENAME}} export-metadata --chain=frequency-paseo-local --tmp ./js/api-augment/metadata.json | |
- name: Build | |
run: npm run build | |
working-directory: js/api-augment | |
- name: Test | |
run: npm test | |
working-directory: js/api-augment | |
- name: Build & Publish Dry Run | |
run: npm publish --dry-run | |
working-directory: js/api-augment/dist | |
- name: Generate npm tarball | |
run: npm pack | |
working-directory: js/api-augment/dist | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-api-augment-${{github.run_id}} | |
path: js/api-augment/dist/frequency-chain-api-augment-0.0.0.tgz | |
if-no-files-found: error | |
verify-js-schemas: | |
name: Verify JS Schemas | |
runs-on: ubuntu-22.04 | |
container: ghcr.io/frequency-chain/frequency/ci-base-image:1.3.1 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Set up NodeJs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: js/schemas/package-lock.json | |
- name: Install Latest Versions | |
run: npm install | |
working-directory: js/schemas | |
- name: Lint | |
run: npm run lint | |
working-directory: js/schemas | |
- name: Test | |
run: npm test | |
working-directory: js/schemas | |
- name: Build | |
run: npm run build | |
working-directory: js/schemas | |
- name: Publish Dry Run | |
run: npm publish --dry-run | |
working-directory: js/schemas/dist | |
- name: Generate npm tarball | |
run: npm pack | |
working-directory: js/schemas/dist | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts-schemas-${{github.run_id}} | |
path: js/schemas/dist/frequency-chain-schemas-0.0.0.tgz | |
if-no-files-found: error | |
verify-node-docker-images: | |
needs: build-binaries | |
name: Verify Node Docker Images | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Set Env Vars | |
run: | | |
echo "BUILT_BIN_FILENAME=frequency.mainnet.frequency.pr" >> $GITHUB_ENV | |
echo "DOCKER_BIN_FILENAME=frequency" >> $GITHUB_ENV | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-*-${{github.run_id}} | |
path: ${{env.BIN_DIR}} | |
merge-multiple: true | |
- name: List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Rename Binary | |
working-directory: ${{env.BIN_DIR}} | |
run: mv ${{env.BUILT_BIN_FILENAME}} ${{env.DOCKER_BIN_FILENAME}} | |
- name: Set Binary Permissions | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
chmod 755 ${{env.DOCKER_BIN_FILENAME}} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: "amd64" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build collator standalone | |
env: | |
IMAGE_NAME: standalone-node | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: false | |
file: ./docker/${{env.IMAGE_NAME}}.dockerfile | |
- name: Build collator image for local relay chain | |
env: | |
IMAGE_NAME: collator-node-local | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: false | |
file: docker/${{env.IMAGE_NAME}}.dockerfile | |
execute-binary-checks: | |
needs: build-binaries | |
name: Execute Binary Checks | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Set Env Vars | |
run: | | |
echo "TEST_BIN_FILENAME=frequency.mainnet.frequency.pr" >> $GITHUB_ENV | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-mainnet-pr-${{github.run_id}} | |
path: ${{env.BIN_DIR}} | |
- name: List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Set Binary Permissions | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
chmod 755 ${{env.TEST_BIN_FILENAME}} | |
- name: Output Binary Version | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
file ./${{env.TEST_BIN_FILENAME}} && ./${{env.TEST_BIN_FILENAME}} --version | |
check-metadata-and-spec-version: | |
needs: build-binaries | |
name: Check Metadata and Spec Version | |
runs-on: ubuntu-22.04 | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Env Vars | |
run: | | |
echo "TEST_BIN_FILENAME=frequency.local.frequency-local.pr" >> $GITHUB_ENV | |
echo "REF_BIN_FILENAME=frequency.local.frequency-local.main" >> $GITHUB_ENV | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-local-*-${{github.run_id}} | |
path: ${{env.BIN_DIR}} | |
merge-multiple: true | |
- name: List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Set Binary Permissions | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
chmod 755 $TEST_BIN_FILENAME | |
chmod 755 $REF_BIN_FILENAME | |
- name: Compare Metadata | |
id: compare-metadata | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
set -x | |
./$REF_BIN_FILENAME export-metadata --chain=frequency-paseo-local --tmp metadata-ref.json | |
metadata_ref=$(cat metadata-ref.json | jq -r .result) | |
./$TEST_BIN_FILENAME export-metadata --chain=frequency-paseo-local --tmp metadata.json | |
metadata=$(cat metadata.json | jq -r .result) | |
matches=$([ "$metadata" = "$metadata_ref" ] && echo 'true' || echo 'false') | |
echo "Metadata matches?: $match" | |
echo "metadata_matches=$matches" >> $GITHUB_OUTPUT | |
- name: Assign Metadata Changed Label | |
if: steps.compare-metadata.outputs.metadata_matches != 'true' | |
uses: RobinJesba/GitHub-Labeler-Action@2f69380bbf2ee60b2f0893ef0f40582c9a34a64d | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
LABELS_TO_ADD: ${{env.PR_LABEL_METADATA_CHANGED}} | |
- name: Check Spec Version | |
if: steps.compare-metadata.outputs.metadata_matches != 'true' | |
id: check-spec-version | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
set -x | |
spec_version_ref=$(./$REF_BIN_FILENAME export-runtime-version | jq -r .specVersion) | |
spec_version=$(./$TEST_BIN_FILENAME export-runtime-version | jq -r .specVersion) | |
incremented=$([ $spec_version -gt $spec_version_ref ] && echo 'true' || echo 'false') | |
echo "spec_version_ref=$spec_version_ref" >> $GITHUB_OUTPUT | |
echo "spec_version=$spec_version" >> $GITHUB_OUTPUT | |
echo "metadata_version_incremented=$incremented" >> $GITHUB_OUTPUT | |
- name: Assign Metadata Version Not Incremented Label | |
if: | | |
(steps.compare-metadata.outputs.metadata_matches != 'true') && | |
(steps.check-spec-version.outputs.metadata_version_incremented != 'true') | |
uses: RobinJesba/GitHub-Labeler-Action@2f69380bbf2ee60b2f0893ef0f40582c9a34a64d | |
with: | |
GITHUB_TOKEN: ${{ github.token }} | |
LABELS_TO_ADD: ${{env.PR_LABEL_METADATA_VERSION_NOT_INCREMENTED}} | |
- name: Fail CI | |
if: | | |
(steps.compare-metadata.outputs.metadata_matches != 'true') && | |
(steps.check-spec-version.outputs.metadata_version_incremented != 'true') | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
spec_version=${{steps.check-spec-version.outputs.spec_version}} | |
spec_version_ref=${{steps.check-spec-version.outputs.spec_version_ref}} | |
echo "ERROR: When metadata is updated, the new spec version ($spec_version)\ | |
must be greater than the latest version on main branch ($spec_version_ref)" | |
exit 1 | |
run-e2e: | |
if: needs.changes.outputs.run-e2e == 'true' | |
needs: [build-binaries, verify-js-api-augment] | |
name: Run E2E Tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Env Vars | |
run: | | |
echo "BIN_FILENAME=frequency.dev.frequency-no-relay.pr" >> $GITHUB_ENV | |
echo "FREQUENCY_PROCESS_NAME=frequency" >> $GITHUB_ENV | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-dev-pr-${{github.run_id}} | |
path: ${{env.BIN_DIR}} | |
- name: List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
mv "${download_dir}"/artifacts*/* "${download_dir}" | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Download api-augment tarball | |
uses: actions/download-artifact@v4 | |
with: | |
name: artifacts-api-augment-${{github.run_id}} | |
path: js/api-augment/dist | |
- name: Set Binaries Permissions | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
chmod 755 $BIN_FILENAME | |
- name: Start Local Node | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
./${{env.BIN_FILENAME}} \ | |
-lruntime=debug \ | |
--dev \ | |
--sealing=instant \ | |
--wasm-execution=compiled \ | |
--no-telemetry \ | |
--no-prometheus \ | |
--port $((30333)) \ | |
--rpc-port $((9944)) \ | |
--rpc-external \ | |
--rpc-cors all \ | |
--rpc-methods=Unsafe \ | |
--tmp \ | |
& | |
- name: Set up NodeJs | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: e2e/package-lock.json | |
- name: Install Built api-augment | |
run: npm install ../js/api-augment/dist/frequency-chain-api-augment-0.0.0.tgz | |
working-directory: e2e | |
- name: Install NPM Modules | |
run: npm ci | |
working-directory: e2e | |
- name: Lint | |
run: npm run lint | |
working-directory: e2e | |
- name: Run E2E Tests | |
working-directory: e2e | |
env: | |
CHAIN_ENVIRONMENT: dev | |
WS_PROVIDER_URL: ws://127.0.0.1:9944 | |
run: npm test | |
- name: Stop Local Node | |
if: always() | |
run: pkill ${{env.FREQUENCY_PROCESS_NAME}} | |
verify-genesis-state: | |
needs: build-binaries | |
name: Verify Genesis State | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Set Env Vars | |
run: | | |
echo "EXPECTED_GENESIS_STATE_PASEO=0x000000000000000000000000000000000000000000000000000000000000000000805f6ddb6879aa31316a38c149e52ffe4e9f2a193e966ddcf3b6a2cb5846e96903170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400" >> $GITHUB_ENV | |
echo "EXPECTED_GENESIS_STATE_MAINNET=0x000000000000000000000000000000000000000000000000000000000000000000393a2a0f7778716d006206c5a4787cbf2ea3b26a67379b7a38ee54519d7fd4be03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400" >> $GITHUB_ENV | |
echo "BIN_FILENAME_TESTNET=frequency.testnet.frequency-testnet.pr" >> $GITHUB_ENV | |
echo "BIN_FILENAME_MAINNET=frequency.mainnet.frequency.pr" >> $GITHUB_ENV | |
- name: Download Binaries | |
id: download-binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-binary-*-${{github.run_id}} | |
path: ${{env.BIN_DIR}} | |
merge-multiple: true | |
- name: List Downloaded Binaries | |
run: | | |
download_dir=${{steps.download-binaries.outputs.download-path}} | |
echo "Download dir: $download_dir" | |
echo "Downloaded binaries: $(ls -l $download_dir)" | |
- name: Set Binary Permissions | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
chmod 755 $BIN_FILENAME_TESTNET | |
chmod 755 $BIN_FILENAME_MAINNET | |
- name: Test Frequency Paseo Genesis State | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
expected_genesis_state=${{env.EXPECTED_GENESIS_STATE_PASEO}} | |
echo "Expected genesis state: $expected_genesis_state" | |
actual_genesis_state=$(./${{env.BIN_FILENAME_TESTNET}} export-genesis-state --chain=frequency-paseo) | |
echo "Actual genesis state: $actual_genesis_state" | |
[ $actual_genesis_state = $expected_genesis_state ] || \ | |
(echo "ERROR: The actual genesis state does not match the expected" && exit 1) | |
- name: Test Frequency Mainnet Genesis State | |
working-directory: ${{env.BIN_DIR}} | |
run: | | |
expected_genesis_state=${{env.EXPECTED_GENESIS_STATE_MAINNET}} | |
echo "Expected genesis state: $expected_genesis_state" | |
actual_genesis_state=$(./${{env.BIN_FILENAME_MAINNET}} export-genesis-state) | |
echo "Actual genesis state: $actual_genesis_state" | |
[ $actual_genesis_state = $expected_genesis_state ] || \ | |
(echo "ERROR: The actual genesis state does not match the expected" && exit 1) |