From 32e3ac004b506013b9a9f60a7b0221c8fd65a11e Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli <> Date: Tue, 19 Dec 2023 09:41:16 +0100 Subject: [PATCH 1/2] ci: split integration and unit --- .github/workflows/build-and-test.yml | 95 +++++++++++++++++++++++++++- Makefile | 7 ++ 2 files changed, 99 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 45a6e4dd6a..4e9ccf0c63 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -185,7 +185,7 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_SECRET_KEY }} - unit-and-integration-tests: + test-unit: runs-on: group: namada-runners timeout-minutes: 30 @@ -261,8 +261,8 @@ jobs: - uses: taiki-e/install-action@cargo-llvm-cov - name: Check crates build with default features run: make check-crates - - name: Run unit and integration tests - run: make test-coverage + - name: Run unit tests + run: make test-unit-with-coverage env: NAMADA_MASP_PARAMS_DIR: /home/runner/.masp-params RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold" @@ -283,6 +283,95 @@ jobs: cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache cargo-cache + test-integration: + runs-on: + group: namada-runners + timeout-minutes: 30 + needs: [build-wasm] + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + nightly_version: [nightly-2023-06-01] + mold_version: [2.3.2] + make: + - name: ABCI + + env: + RUSTC_WRAPPER: sccache + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + if: ${{ github.event_name != 'pull_request_target' }} + - name: Checkout PR + uses: actions/checkout@v4 + if: ${{ github.event_name == 'pull_request_target' }} + # See comment in build-and-test.yml + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Install libudev + run: sudo apt-get update && sudo apt-get -y install libudev-dev + - name: Install Protoc + uses: heliaxdev/setup-protoc@v2 + with: + version: "25.0" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 + - name: Setup rust toolchain + uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 + with: + profile: default + override: true + - name: Setup rust nightly + uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 + with: + toolchain: ${{ matrix.nightly_version }} + profile: default + - name: Cache cargo registry + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + key: ${{ runner.os }}-${{ github.job }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- + - name: Start sccache server + run: sccache --start-server + - name: Install mold linker + run: | + wget -q -O- https://github.com/rui314/mold/releases/download/v${{ matrix.mold_version }}/mold-${{ matrix.mold_version }}-x86_64-linux.tar.gz | tar -xz + mv mold-${{ matrix.mold_version }}-x86_64-linux/bin/mold /usr/local/bin + - name: Download MASP parameters + run: | + mkdir -p /home/runner/.masp-params + curl -o /home/runner/.masp-params/masp-spend.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-spend.params\?raw\=true + curl -o /home/runner/.masp-params/masp-output.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-output.params?raw=true + curl -o /home/runner/.masp-params/masp-convert.params -L https://github.com/anoma/masp-mpc/releases/download/namada-trusted-setup/masp-convert.params?raw=true + - name: Download wasm artifacts + uses: actions/download-artifact@v3 + with: + name: wasm-${{ github.event.pull_request.head.sha|| github.sha }} + path: ./wasm + - name: Run integration tests + run: make test-integration + env: + NAMADA_MASP_PARAMS_DIR: /home/runner/.masp-params + RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=/usr/local/bin/mold" + - name: Print sccache stats + if: always() + run: sccache --show-stats || true + - name: Stop sccache server + if: always() + run: sccache --stop-server || true + - name: Clean cargo cache + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache + cargo-cache + run-benchmarks: runs-on: group: namada-runners diff --git a/Makefile b/Makefile index 6b7441b01a..f9e016911e 100644 --- a/Makefile +++ b/Makefile @@ -185,6 +185,13 @@ test-unit: -- --skip e2e --skip integration --skip pos_state_machine_test \ -Z unstable-options --report-time +test-unit-with-coverage: + $(cargo) +$(nightly) llvm-cov --output-dir target \ + --features namada/testing \ + --html \ + -- --skip e2e --skip pos_state_machine_test --skip integration \ + -Z unstable-options --report-time + test-unit-mainnet: $(cargo) +$(nightly) test \ --features "mainnet" \ From 0359b73a692f331bf7655b7f9678e68d7e850b5b Mon Sep 17 00:00:00 2001 From: Gianmarco Fraccaroli <> Date: Tue, 19 Dec 2023 09:42:43 +0100 Subject: [PATCH 2/2] ci: update mold --- .github/workflows/build-and-test.yml | 16 ++++++++-------- .github/workflows/triggerable.yml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4e9ccf0c63..dfcc4ddf2c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -43,7 +43,7 @@ jobs: matrix: os: [ubuntu-latest] wasm_cache_version: ["v2"] - mold_version: [2.3.2] + mold_version: [2.4.0] steps: - name: Checkout repo @@ -102,7 +102,7 @@ jobs: os: [ubuntu-latest] wasm_cache_version: ["v2"] nightly_version: [nightly-2023-06-01] - mold_version: [2.3.2] + mold_version: [2.4.0] steps: - name: Checkout repo @@ -165,7 +165,7 @@ jobs: os: [ubuntu-latest] wasm_cache_version: ["v2"] nightly_version: [nightly-2023-06-01] - mold_version: [2.3.2] + mold_version: [2.4.0] steps: - name: Download wasm artifacts @@ -195,7 +195,7 @@ jobs: matrix: os: [ubuntu-latest] nightly_version: [nightly-2023-06-01] - mold_version: [2.3.2] + mold_version: [2.4.0] make: - name: ABCI @@ -293,7 +293,7 @@ jobs: matrix: os: [ubuntu-latest] nightly_version: [nightly-2023-06-01] - mold_version: [2.3.2] + mold_version: [2.4.0] make: - name: ABCI @@ -382,7 +382,7 @@ jobs: matrix: os: [ubuntu-latest] nightly_version: [nightly-2023-06-01] - mold_version: [2.3.2] + mold_version: [2.4.0] make: - name: ABCI @@ -468,7 +468,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - mold_version: [2.3.2] + mold_version: [2.4.0] make: - name: ABCI Release build @@ -570,7 +570,7 @@ jobs: matrix: os: [ubuntu-latest] nightly_version: [nightly-2023-06-01] - mold_version: [2.3.2] + mold_version: [2.4.0] comet_bft: [0.37.2] hermes: [1.6.0-namada-beta1] make: diff --git a/.github/workflows/triggerable.yml b/.github/workflows/triggerable.yml index bcc9cbddb5..99551f6f9f 100644 --- a/.github/workflows/triggerable.yml +++ b/.github/workflows/triggerable.yml @@ -33,7 +33,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - mold_version: [2.3.2] + mold_version: [2.4.0] name: ["Run PoS state-machine tests"] command: ["make test-pos-sm"] timeout: [360]