Skip to content

Build + Test

Build + Test #14364

Workflow file for this run

name: Build + Test
on:
push:
branches:
- albatross
- testnet
pull_request:
merge_group:
workflow_dispatch:
jobs:
# rustfmt:
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@nightly
# with:
# components: rustfmt
# - run: cargo fmt --all -- --check
# check:
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/[email protected] # Also test our Rust MSRV here.
# - uses: Swatinem/rust-cache@v2
# - run: cargo check --all-features --tests --benches
# test:
# runs-on: ubuntu-22.04
# steps:
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# tool-cache: true
# large-packages: false
# - uses: actions/checkout@v4
# - name: "Check for duplicate message IDs"
# run: "! grep -rEoh --exclude-dir tests --exclude-dir target 'TYPE_ID: u16 = [^;]+;' | sort | uniq -d | grep '^'"
# - uses: dtolnay/rust-toolchain@stable
# with:
# components: llvm-tools-preview
# - uses: Swatinem/rust-cache@v2
# - name: Install cargo-nextest
# run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin
# # Coverage is disabled for now since at the moment it has a considerable performance impact in the CI
# #- name: Install cargo-llvm-cov
# # run: cargo install cargo-llvm-cov
# #- name: Remove possible stale artifacts
# # run: cargo llvm-cov clean --workspace
# #- name: Run test with coverage instrumentation
# # run: cargo llvm-cov nextest --features=nimiq-zkp-component/test-prover
# # Fixme: --doctest is not supported in stable. See:
# # https://github.com/taiki-e/cargo-llvm-cov/tree/7448e48b438797efb446a98ebd8ff22d3fae5ebe#known-limitations
# # run: cargo llvm-cov --features=nimiq-zkp-component/test-prover --doctests
# #- name: Generate coverage report
# # run: cargo llvm-cov report --lcov --output-path coverage.lcov
# #- name: Upload coverage to Codecov
# # uses: codecov/codecov-action@v3
# # with:
# # files: coverage.lcov
# # fail_ci_if_error: false
# # flags: unittests
# # name: Nimiq code coverage
# # verbose: true
# - name: Run tests
# run: cargo nextest run --features=nimiq-zkp-component/test-prover
# # Currently `nextest` doesn't support doctest so we have to run them apart
# - name: Run doctest
# run: cargo test --doc
# clippy:
# if: github.event_name != 'push' || github.event.pusher.name != 'dependabot[bot]'
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# with:
# components: clippy
# - uses: Swatinem/rust-cache@v2
# - uses: actions-rs/clippy-check@v1
# with:
# name: Clippy Report
# token: ${{ secrets.GITHUB_TOKEN }}
# args: --release --all-features
# web-client:
# runs-on: ubuntu-22.04
# steps:
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# # this might remove tools that are actually needed,
# # if set to "true" but frees about 6 GB
# tool-cache: true
# # all of these default to true, but feel free to set to
# # "false" if necessary for your workflow
# android: true
# dotnet: true
# haskell: true
# large-packages: false
# swap-storage: true
# - uses: actions/checkout@v4
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Install wasm-pack
# run: cargo install wasm-pack
# - name: Execute wasm unittests
# working-directory: ./web-client
# run: wasm-pack test --chrome --headless
web-client-lib:
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
large-packages: false
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
- name: Compile to wasm and generate bindings
working-directory: ./web-client
run: ./scripts/build.sh --only nodejs,types
- name: Install dependencies in the web-client/dist folder
working-directory: ./web-client/dist
run: yarn install
- name: Execute unittests
working-directory: ./web-client/extras
run: yarn test PrivateKey
# reconnect-test:
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# with:
# python-version: '3.8'
# - name: Install python dependencies
# run: pip install scripts/devnet
# - name: Set up Rust toolchain
# uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - name: Build the code
# run: cargo build
# - name: Executes the 4 validators reconnecting scenario
# run: |
# python3 scripts/devnet/devnet.py -t .github/devnet_topologies/four_validators.toml -r 1
# - name: Archive test results
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: reconnect-test-logs
# path: |
# temp-logs/