|
| 1 | +name: Testing and Code Coverage |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # runs 5min after midnight, everyday |
| 6 | + - cron: '5 0 * * *' |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + RUSTFLAGS: -D warnings |
| 11 | + RUST_BACKTRACE: 1 |
| 12 | + CARGO_INCREMENTAL: 0 |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.sha }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + unit-tests: |
| 20 | + name: Unit Tests |
| 21 | + runs-on: ubuntu-latest |
| 22 | + needs: [integration-tests] |
| 23 | + env: |
| 24 | + CARGO_FLAGS: --verbose --locked |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v3 |
| 28 | + |
| 29 | + - uses: Swatinem/rust-cache@v2 |
| 30 | + with: |
| 31 | + shared-key: "cov" |
| 32 | + save-if: "true" |
| 33 | + |
| 34 | + - name: Install Rust toolchain |
| 35 | + uses: actions-rs/toolchain@v1 |
| 36 | + with: |
| 37 | + toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this |
| 38 | + components: llvm-tools-preview |
| 39 | + |
| 40 | + - name: Install cargo-nextest |
| 41 | + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin |
| 42 | + |
| 43 | + - name: Install cargo-llvm-cov |
| 44 | + uses: taiki-e/install-action@cargo-llvm-cov |
| 45 | + |
| 46 | + - name: Install system deps |
| 47 | + run: |
| 48 | + sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config |
| 49 | + |
| 50 | + - name: Run unit tests |
| 51 | + run: | |
| 52 | + cargo llvm-cov nextest --no-report --manifest-path ./src/catalyst-toolbox/catalyst-toolbox/Cargo.toml --profile ci |
| 53 | + cargo llvm-cov nextest --no-report --manifest-path ./src/catalyst-toolbox/snapshot-lib/Cargo.toml --profile ci |
| 54 | +
|
| 55 | + cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-cli/Cargo.toml --profile ci |
| 56 | + cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-lib/Cargo.toml --profile ci |
| 57 | + cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-server/Cargo.toml --profile ci |
| 58 | +
|
| 59 | + cargo llvm-cov nextest --no-report --manifest-path ./src/voting-tools-rs/Cargo.toml --profile ci |
| 60 | +
|
| 61 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/cardano-legacy-address/Cargo.toml --profile ci |
| 62 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-addr/Cargo.toml --profile ci |
| 63 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-core/Cargo.toml --profile ci |
| 64 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-crypto/Cargo.toml --profile ci |
| 65 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-evm/Cargo.toml --profile ci |
| 66 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-impl-mockchain/Cargo.toml --profile ci |
| 67 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-network/Cargo.toml --profile ci |
| 68 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-ser/Cargo.toml --profile ci |
| 69 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-storage/Cargo.toml --profile ci |
| 70 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-time/Cargo.toml --profile ci |
| 71 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/chain-vote/Cargo.toml --profile ci |
| 72 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/imhamt/Cargo.toml --profile ci |
| 73 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/sparse-array/Cargo.toml --profile ci |
| 74 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-libs/typed-bytes/Cargo.toml --profile ci |
| 75 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/bindings/wallet-c/Cargo.toml --profile ci |
| 76 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/bindings/wallet-core/Cargo.toml --profile ci |
| 77 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/bindings/wallet-wasm-js/Cargo.toml --profile ci |
| 78 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/chain-path-derivation/Cargo.toml --profile ci |
| 79 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/hdkeygen/Cargo.toml --profile ci |
| 80 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/symmetric-cipher/Cargo.toml --profile ci |
| 81 | + cargo llvm-cov nextest --no-report --manifest-path ./src/chain-wallet-libs/wallet/Cargo.toml --profile ci |
| 82 | +
|
| 83 | + cargo llvm-cov nextest --no-report --manifest-path ./src/jormungandr/jormungandr/Cargo.toml --profile ci |
| 84 | + cargo llvm-cov report --lcov --output-path ./lcov.info |
| 85 | + - name: Upload code coverage to coveralls.io |
| 86 | + uses: coverallsapp/github-action@master |
| 87 | + with: |
| 88 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 89 | + path-to-lcov: "./lcov.info" |
| 90 | + |
| 91 | + integration-tests: |
| 92 | + name: Integration Tests |
| 93 | + runs-on: ubuntu-latest |
| 94 | + env: |
| 95 | + CARGO_FLAGS: --verbose --locked |
| 96 | + steps: |
| 97 | + - name: Checkout code |
| 98 | + uses: actions/checkout@v3 |
| 99 | + |
| 100 | + - uses: Swatinem/rust-cache@v2 |
| 101 | + with: |
| 102 | + shared-key: "cov" |
| 103 | + save-if: "true" |
| 104 | + |
| 105 | + - name: Install Rust toolchain |
| 106 | + uses: actions-rs/toolchain@v1 |
| 107 | + with: |
| 108 | + toolchain: "1.65" # it says it can read the rust-toolchain file, but it fails if we omit this |
| 109 | + components: llvm-tools-preview |
| 110 | + |
| 111 | + - name: Install cargo-nextest |
| 112 | + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin |
| 113 | + |
| 114 | + - name: Install cargo-llvm-cov |
| 115 | + uses: taiki-e/install-action@cargo-llvm-cov |
| 116 | + |
| 117 | + - name: Install system deps |
| 118 | + run: |
| 119 | + sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config |
| 120 | + |
| 121 | + - name: Run integration tests |
| 122 | + run: | |
| 123 | + source <(cargo llvm-cov show-env --export-prefix) |
| 124 | + cargo build -p jcli -p jormungandr -p explorer -p vit-servicing-station-cli -p vit-servicing-station-server |
| 125 | + cargo llvm-cov nextest --no-report --manifest-path ./src/vit-servicing-station/vit-servicing-station-tests/Cargo.toml --profile ci |
| 126 | + cargo llvm-cov nextest --no-report --manifest-path ./src/jormungandr/testing/jormungandr-integration-tests/Cargo.toml --profile ci |
0 commit comments