Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: black-box integration tests #5087

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 31 additions & 67 deletions .github/workflows/iroha2-dev-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
CARGO_TERM_COLOR: always
IROHA_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"
DOCKER_COMPOSE_PATH: defaults
WASM_SAMPLES_TARGET_DIR: wasm_samples/target/prebuilt

jobs:
consistency:
Expand Down Expand Up @@ -60,27 +61,33 @@ jobs:
name: report-clippy
path: clippy.json

build_executor:
build_wasm_samples:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build iroha executor
run: mold --run cargo run --bin iroha_wasm_builder -- build ./wasm_samples/default_executor --optimize --out-file ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
- name: Upload executor to reuse in other jobs
- name: Build
run: ./scripts/build_wasm_samples.sh
- name: Upload all built WASMs
uses: actions/upload-artifact@v4
with:
name: wasm_samples
path: ${{ env.WASM_SAMPLES_TARGET_DIR }}
retention-days: 1
- name: Upload executor.wasm specifically
uses: actions/upload-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}/executor.wasm
retention-days: 1

unit_tests_with_coverage:
test_with_coverage:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
needs: build_executor
needs: build_wasm_samples
env:
LLVM_PROFILE_FILE_NAME: "iroha-%p-%m.profraw"
steps:
Expand All @@ -90,24 +97,29 @@ jobs:
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- name: Download the rest of WASM samples
uses: actions/download-artifact@v4
with:
name: wasm_samples
path: ${{ env.WASM_SAMPLES_TARGET_DIR }}
- name: Install irohad
run: which irohad || cargo install --path crates/irohad --locked
- uses: taiki-e/install-action@nextest
- uses: taiki-e/install-action@cargo-llvm-cov
- name: Run unit tests (no default features)
- name: Run tests (no default features)
run: >
mold --run cargo llvm-cov nextest
--no-fail-fast
--workspace --lib
--no-default-features
--branch
--no-report
- name: Run unit tests (all features)
--workspace --no-default-features
--no-fail-fast --retries 2
--failure-output immediate-final
--branch --no-report
- name: Run tests (all features)
run: >
mold --run cargo llvm-cov nextest
--no-fail-fast
--workspace --lib
--all-features
--branch
--no-report
--workspace --all-features
--no-fail-fast --retries 2
--failure-output immediate-final
--branch --no-report
- name: Generate lcov report
run: cargo llvm-cov report --lcov --output-path lcov.info
- name: Upload lcov report
Expand All @@ -116,54 +128,6 @@ jobs:
name: report-coverage
path: lcov.info

# include: iroha/tests/integration/
# exclude: iroha/tests/integration/extra_functional
integration:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
needs: build_executor
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Download executor.wasm
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- uses: taiki-e/install-action@nextest
- name: Run integration tests, with all features
run: >
mold --run cargo nextest run
--all-features
--no-fail-fast
--failure-output immediate-final
-E 'package(iroha) and test(integration) and not test(extra_functional)'

# include: iroha/tests/integration/extra_functional
extra_functional:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
needs: build_executor
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: Download executor.wasm
uses: actions/download-artifact@v4
with:
name: executor.wasm
path: ${{ env.DOCKER_COMPOSE_PATH }}
- uses: taiki-e/install-action@nextest
- name: Run integration tests, with all features
run: >
mold --run cargo nextest run
--all-features
--no-fail-fast
--failure-output final
--test-threads 1
-E 'test(extra_functional)'

# Run the job to check that the docker containers are properly buildable
pr-generator-build:
# Job will only execute if the head of the pull request is a branch for PR-generator case
Expand Down Expand Up @@ -198,7 +162,7 @@ jobs:
context: .

docker-compose-and-pytests:
needs: build_executor
needs: build_wasm_samples
runs-on: [self-hosted, Linux, iroha2]
timeout-minutes: 60
env:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ result
/test/
/iroha-java/
/lcov.info
**/test-smartcontracts/
test_docker
**/*.wasm
.iroha_test_network_run.json*
Loading
Loading