Skip to content

Commit

Permalink
ci: separate tests into component suites (#650)
Browse files Browse the repository at this point in the history
Optimizes GH action times by running component tests in parallel
  • Loading branch information
rafaelcr authored Oct 4, 2024
1 parent a2965c2 commit 8c68352
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ concurrency:
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
suite: [cli, sdk]
defaults:
run:
working-directory: ./components/chainhook-${{ matrix.suite }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -29,7 +36,10 @@ jobs:
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV
- name: Install redis
run: sudo apt-get install -y redis-server
if: matrix.suite == 'cli'
run: |
sudo apt-get install -y redis-server
echo "TARPAULIN_FLAGS=--features redis_tests" >> $GITHUB_ENV
- name: Cache cargo
uses: actions/cache@v4
Expand All @@ -43,12 +53,15 @@ jobs:
~/.cargo/.crates.toml
~/.cargo/.crates2.json
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-${{ matrix.suite }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install and run cargo-tarpaulin
- name: Install cargo-tarpaulin
run: |
cargo install cargo-tarpaulin
cargo tarpaulin --skip-clean --out lcov --features redis_tests -- --test-threads=1
- name: Run tests
run: |
cargo tarpaulin --skip-clean --out lcov ${{ env.TARPAULIN_FLAGS }} -- --test-threads=1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ components/chainhook-types-js/dist
*.rdb
*.redb
cache/
Chainhook.toml

components/chainhook-cli/src/service/tests/fixtures/tmp
components/chainhook-cli/src/archive/tests/fixtures/tmp

0 comments on commit 8c68352

Please sign in to comment.