Skip to content

ci: fix with_coverage, isolate not unstable but extra_functional #9420

ci: fix with_coverage, isolate not unstable but extra_functional

ci: fix with_coverage, isolate not unstable but extra_functional #9420

Workflow file for this run

name: I2::Dev::Tests
on:
pull_request:
branches: [main]
paths:
- '**.rs'
- '**.json'
- '**.toml'
- '**.lock'
- '.github/workflows/iroha2-dev-pr.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CLIENT_CLI_DIR: "/__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}/test"
jobs:
consistency:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Check genesis.json
if: always()
run: ./scripts/tests/consistency.sh genesis
- name: Check schema.json
if: always()
run: ./scripts/tests/consistency.sh schema
- name: Check Docker Compose configurations
if: always()
run: ./scripts/tests/consistency.sh docker-compose
# exclude: client/tests/integration/
with_coverage:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run tests, with coverage
run: |
mold --run cargo test --all-features --no-fail-fast --workspace --exclude iroha_client
mold --run cargo test --all-features --no-fail-fast -p iroha_client -- --skip integration
env:
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "iroha-%p-%m.profraw"
- name: Generate lcov report
if: always()
run: grcov . --binary-path ./target/debug/ -s . -t lcov -o lcov.info --branch --ignore-not-existing --ignore "/client_cli" --ignore "**/main.rs" --ignore "**/build.rs" --ignore "**/benches" --ignore "**/examples" --ignore "**/tests" --ignore "**/test_network" --ignore "**/target" --ignore "**/usr"
- name: Upload coverage to coveralls.io
if: always()
uses: coverallsapp/github-action@v2
with:
file: lcov.info
compare-ref: ${{ github.base_ref }}
compare-sha: ${{ github.event.pull_request.base.sha}}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload lcov report artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: lcov.info
path: lcov.info
# migrating to pytest
# include: client/tests/integration/
# exclude: "unstable_network"
client_integration:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run tests, with no-default-features
run: mold --run cargo test --no-default-features --no-fail-fast -p iroha_client integration -- --skip unstable_network
# include: client/tests/integration/, "unstable_network"
unstable:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Run tests
run: mold --run cargo test --no-default-features --no-fail-fast -p iroha_client unstable_network
# 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
if: startsWith(github.head_ref, 'iroha2-pr-deploy/')
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
steps:
- uses: actions/checkout@v4
- name: Login to Soramitsu Harbor
uses: docker/login-action@v3
with:
registry: docker.soramitsu.co.jp
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Set up Docker Buildx
id: buildx
if: always()
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Build and push iroha2:dev image
uses: docker/build-push-action@v4
if: always()
with:
push: true
tags: docker.soramitsu.co.jp/iroha2/iroha2:dev-${{ github.event.pull_request.head.sha }}
labels: commit=${{ github.sha }}
build-args: TAG=dev
file: Dockerfile
# This context specification is required
context: .
client-cli-tests:
runs-on: [self-hosted, Linux, iroha2]
container:
image: hyperledger/iroha2-ci:nightly-2024-04-18
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: Swatinem/rust-cache@v2
- name: Build binaries
run: |
cargo build -p iroha_client_cli -p kagami -p iroha
- name: Setup test Iroha 2 environment on the bare metal
run: |
pip3 install -r scripts/requirements.txt --no-input --break-system-packages
./scripts/test_env.py setup
- name: Mark binaries as executable
run: |
chmod +x ${{ env.CLIENT_CLI_DIR }}
- name: Install dependencies using Poetry
working-directory: client_cli/pytests
run: |
poetry install
- name: Run client cli tests
working-directory: client_cli/pytests
env:
# prepared by `test_env.py`
CLIENT_CLI_BINARY: ../../test/iroha_client_cli
CLIENT_CLI_CONFIG: ../../test/client.toml
run: |
poetry run pytest
- name: Cleanup test environment
run: |
./scripts/test_env.py cleanup