Skip to content

Commit

Permalink
chore(ci): run integration tests on PRs (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas authored May 16, 2024
1 parent 1c12c8f commit 3de177e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 49 deletions.
52 changes: 48 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ jobs:
run: npm run lint
- name: VSCode Extension NPM Build
run: just build-extension
integration:
name: Integration Tests
if: github.ref == 'refs/heads/main'
uses: ./.github/workflows/integration.yml
build-all:
name: Rebuild All
runs-on: ubuntu-latest
Expand All @@ -146,3 +142,51 @@ jobs:
run: just init-db
- name: Rebuild All
run: just build-all
integration-shard:
name: Shard Integration Tests
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extract-tests.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Init Hermit
uses: cashapp/activate-hermit@v1
- name: Extract test cases
id: extract-tests
run: |
# shellcheck disable=SC2046
echo "matrix={\"test\":$(jq -c -n '$ARGS.positional' --args $(git grep -l '^//go:build integration' | xargs grep '^func Test' | awk '{print $2}' | cut -d'(' -f1))}" >> "$GITHUB_OUTPUT"
integration-run:
name: Integration Test
needs: integration-shard
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix: ${{fromJson(needs.integration-shard.outputs.matrix)}}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Init Hermit
uses: cashapp/activate-hermit@v1
with:
cache: true
- name: Build Cache
uses: ./.github/actions/build-cache
- name: Docker Compose
run: docker compose up -d --wait
- name: Create DB
run: just init-db
- name: Download Go Modules
run: go mod download
- name: Run ${{ matrix.test }}
run: |
# shellcheck disable=SC2046
go test -v -race -tags integration -run ${{ matrix.test }} $(git grep -l '^//go:build integration' | xargs -I {} dirname './{}' | sort | uniq)
integration-success:
name: Integration Success
needs: [integration-run]
runs-on: ubuntu-latest
steps:
- name: Ok
run: echo "Integration tests passed"
45 changes: 0 additions & 45 deletions .github/workflows/integration.yml

This file was deleted.

0 comments on commit 3de177e

Please sign in to comment.