Skip to content

Commit

Permalink
ci: add coverage to integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdeafbeef committed Nov 4, 2024
1 parent 9324b13 commit 9292055
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 22 deletions.
5 changes: 4 additions & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[profile.default]
slow-timeout = { period = "120s", terminate-after = 1 }
retries = 3 # for flaky tests
retries = 3 # for flaky tests

[profile.integration]
slow-timeout = { period = "3600s", terminate-after = 1 }
31 changes: 13 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,31 @@ jobs:
integration-test:
name: Integration Test Suite
runs-on: [self-hosted, linux]
needs: test
needs: rustfmt
steps:
- uses: actions/checkout@v3
- name: Install Clang
run: sudo apt-get update && sudo apt-get install -y clang
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- uses: extractions/setup-just@v2
- name: Run integration tests
- name: Run integration tests with coverage
env:
RUST_LOG: warn
run: just run_integration_tests

cli-builds:
name: tycho-cli check
runs-on: [self-hosted, linux]
needs: rustfmt
steps:
- uses: actions/checkout@v3
- name: Install Clang
run: sudo apt-get update && sudo apt-get install -y clang
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
run: just run_integration_tests_cov
- name: Upload integration test coverage to Codecov
uses: codecov/codecov-action@v3
if: github.repository == 'broxus/tycho'
with:
cache-on-failure: true
- uses: extractions/setup-just@v2
- name: Build CLI
run: just build
token: ${{ secrets.CODECOV_TOKEN }}
files: integration_codecov.json
fail_ci_if_error: true

metrics:
name: Metrics
Expand Down
24 changes: 24 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,31 @@ update_rpc_proto:
cargo run -p tycho-gen-protos

# === Integration tests stuff ===
run_integration_tests_cov: prepare_integration_tests
#!/usr/bin/env bash
set -euo pipefail
export INTEGRATION_TEST=1
if [ -n "${CI:-}" ]; then
# Running in CI
RUST_BACKTRACE=1 cargo llvm-cov nextest \
--package tycho-core \
--profile integration \
--cargo-profile release_check \
--test archives heavy_archives \
--run-ignored all \
--output-path integration_codecov.json \
--codecov
else
# Running locally - show coverage report in browser
RUST_BACKTRACE=1 cargo llvm-cov nextest \
--package tycho-core \
--profile integration \
--cargo-profile release_check \
--test archives heavy_archives \
--run-ignored all \
--open
fi
# Runs all tests including ignored. Will take a lot of time to run.
run_integration_tests: prepare_integration_tests
./scripts/run-integration-tests.sh
Expand Down
Empty file modified scripts/common.sh
100644 → 100755
Empty file.
7 changes: 4 additions & 3 deletions scripts/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import sys


blacklist = ["25519", "tokio"]


def main():
blacklist = ["25519", "tokio"]

if os.environ.get("INTEGRATION_TEST"):
blacklist += ["everscale_types" ,"sha2", "digest", "typenum", "ahash"] # otherwise it will took eternity to run the tests
# The first argument is the path to rustc, followed by its arguments
args = sys.argv[1:]

Expand Down

0 comments on commit 9292055

Please sign in to comment.