2023-03-31 13:03:23 +03:00
|
|
|
name: Run tests with workflow_call
|
2022-07-01 16:48:39 +03:00
|
|
|
|
|
|
|
on:
|
2023-03-31 13:03:23 +03:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
ref:
|
|
|
|
description: "git ref to checkout to"
|
|
|
|
type: string
|
|
|
|
default: "master"
|
2023-03-31 17:19:17 +03:00
|
|
|
cargo-dependencies:
|
|
|
|
description: "Cargo dependencies map"
|
|
|
|
type: string
|
|
|
|
default: "null"
|
2022-09-09 16:34:19 +03:00
|
|
|
|
2022-07-01 16:48:39 +03:00
|
|
|
jobs:
|
2023-01-24 16:00:03 +02:00
|
|
|
tests:
|
2023-03-31 13:03:23 +03:00
|
|
|
name: "cargo nextest"
|
2023-01-24 16:00:03 +02:00
|
|
|
timeout-minutes: 60
|
2022-07-01 16:48:39 +03:00
|
|
|
runs-on: builder
|
|
|
|
|
2023-03-02 13:31:05 +02:00
|
|
|
permissions:
|
|
|
|
checks: write # for coverall to create checks
|
|
|
|
|
2022-07-01 16:48:39 +03:00
|
|
|
steps:
|
2023-03-31 17:19:17 +03:00
|
|
|
- name: Checkout AquaVM
|
2023-10-23 13:59:02 +03:00
|
|
|
uses: actions/checkout@v4
|
2023-03-31 17:19:17 +03:00
|
|
|
with:
|
|
|
|
repository: fluencelabs/aquavm
|
|
|
|
ref: ${{ inputs.ref }}
|
2022-07-01 16:48:39 +03:00
|
|
|
|
2023-08-04 14:37:13 +03:00
|
|
|
- name: Setup Rust toolchain
|
|
|
|
uses: dsherret/rust-toolchain-file@v1
|
2022-07-01 16:48:39 +03:00
|
|
|
|
2023-03-17 11:57:31 +02:00
|
|
|
- name: Setup marine
|
|
|
|
uses: fluencelabs/setup-marine@v1
|
2023-09-04 14:57:22 +03:00
|
|
|
with:
|
|
|
|
artifact-name: marine
|
2022-07-01 16:48:39 +03:00
|
|
|
|
2023-03-31 17:19:17 +03:00
|
|
|
- name: Set dependencies
|
|
|
|
if: inputs.cargo-dependencies != 'null'
|
|
|
|
uses: fluencelabs/github-actions/cargo-set-dependency@main
|
|
|
|
with:
|
|
|
|
dependencies: ${{ inputs.cargo-dependencies }}
|
|
|
|
|
2022-09-09 16:34:19 +03:00
|
|
|
- name: Build Wasm binary for tests
|
2022-07-01 16:48:39 +03:00
|
|
|
run: ./build_test_binaries.sh
|
|
|
|
working-directory: air/tests/test_module
|
|
|
|
|
2023-03-17 15:11:46 +02:00
|
|
|
- uses: taiki-e/install-action@cargo-llvm-cov
|
|
|
|
- uses: taiki-e/install-action@nextest
|
2023-02-06 19:59:47 +07:00
|
|
|
|
2023-12-21 16:51:15 +03:00
|
|
|
- name: Setup risczero
|
|
|
|
uses: brndnmtthws/rust-action-cargo-binstall@v1
|
|
|
|
with:
|
|
|
|
packages: cargo-risczero
|
|
|
|
|
2023-03-17 15:11:46 +02:00
|
|
|
- run: cargo clean
|
2023-12-21 16:51:15 +03:00
|
|
|
- run: cargo risczero install
|
2023-03-17 15:11:46 +02:00
|
|
|
- run: cargo build
|
2023-03-02 13:31:05 +02:00
|
|
|
|
2023-03-31 13:03:23 +03:00
|
|
|
- name: Run cargo nextest
|
2023-07-21 23:53:56 +07:00
|
|
|
# It should have "--all-features", but it is temporarly disabled because of the signature-related feature flags
|
2023-10-26 13:18:02 +04:00
|
|
|
run: cargo llvm-cov nextest --no-default-features --features test_with_native_code --release --profile ci --lcov --output-path lcov.info
|
2023-03-02 13:31:05 +02:00
|
|
|
|
|
|
|
- name: Coveralls upload
|
2023-03-31 17:19:17 +03:00
|
|
|
if: inputs.cargo-dependencies == 'null'
|
2023-04-18 11:06:23 +03:00
|
|
|
uses: coverallsapp/github-action@v2
|
2023-03-02 13:31:05 +02:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
2023-04-18 11:06:23 +03:00
|
|
|
file: lcov.info
|
2023-03-02 13:31:05 +02:00
|
|
|
|
|
|
|
- name: Archive code coverage results
|
2023-04-10 13:29:36 +03:00
|
|
|
if: inputs.cargo-dependencies == 'null' && !github.event.pull_request.head.repo.fork
|
2023-03-07 11:05:41 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
2023-03-02 13:31:05 +02:00
|
|
|
with:
|
|
|
|
name: code-coverage-report.zip
|
2023-03-17 15:11:46 +02:00
|
|
|
path: lcov.info
|
|
|
|
|
2023-03-31 13:03:23 +03:00
|
|
|
- name: Upload test report
|
|
|
|
uses: dorny/test-reporter@v1
|
2023-04-10 13:29:36 +03:00
|
|
|
if: (success() || failure()) && !github.event.pull_request.head.repo.fork
|
2023-03-31 13:03:23 +03:00
|
|
|
with:
|
|
|
|
name: aquavm report
|
|
|
|
path: target/nextest/ci/junit.xml
|
|
|
|
reporter: java-junit
|
|
|
|
|
2023-03-17 15:11:46 +02:00
|
|
|
- name: Run tests with test_with_native_code
|
2023-03-31 13:03:23 +03:00
|
|
|
env:
|
|
|
|
RUST_TEST_THREADS: 1
|
2023-03-17 15:11:46 +02:00
|
|
|
run: |
|
|
|
|
# The `memory` sanitizer on cargo test has false positive even on empty project.
|
2023-10-26 13:18:02 +04:00
|
|
|
# It shouldn't have `--no-default-features`, but it has until legacy tests will work with signatures enabled.
|
2023-03-17 15:11:46 +02:00
|
|
|
for san in address leak; do
|
2023-10-26 13:18:02 +04:00
|
|
|
RUSTFLAGS="$RUSTFLAGS -Z sanitizer=$san" cargo test --no-default-features --features test_with_native_code --target x86_64-unknown-linux-gnu
|
2023-03-17 15:11:46 +02:00
|
|
|
done
|
2023-10-13 23:19:02 +04:00
|
|
|
- name: Run signature tests with test_with_native_code
|
|
|
|
env:
|
|
|
|
RUST_TEST_THREADS: 1
|
|
|
|
run: |
|
2023-10-26 13:18:02 +04:00
|
|
|
# Temporary solution until legacy tests work with signatures.
|
2023-10-13 23:19:02 +04:00
|
|
|
cargo test --features test_with_native_code,gen_signatures,check_signatures --target x86_64-unknown-linux-gnu features::signatures
|
2023-03-02 13:31:05 +02:00
|
|
|
|
2023-03-15 16:59:30 +07:00
|
|
|
- name: Check native aquavm-air-cli
|
|
|
|
run: cargo check --package aquavm-air-cli --no-default-features
|