Skip to content

Commit

Permalink
chore: ci uses integration tag to find tests (#1379)
Browse files Browse the repository at this point in the history
Two changes:
- CI looks in `intergration` and `backend/controller/cronjobs`
directories for integration tests
- Filters files by ones that include `//go:build integration`
```
$ echo "matrix={\"test\":$(jq -c -n '$ARGS.positional' --args $(grep -r -l '^//go:build integration' integration backend/controller/cronjobs | xargs grep '^func Test' | awk '{print $2}' | cut -d'(' -f1))}"

matrix={"test":["TestCron","TestLifecycle","TestInterModuleCall","TestDatabase","TestSchemaGenerate","TestHttpIngress","TestServiceWithRealDal"]}
```
  • Loading branch information
matt2e authored May 6, 2024
1 parent d47a2f9 commit 319798a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
id: extract-tests
run: |
# shellcheck disable=SC2046
echo "matrix={\"test\":$(jq -c -n '$ARGS.positional' --args $(grep '^func Test' $(find integration -name '*_test.go') | awk '{print $2}' | cut -d'(' -f1))}" >> "$GITHUB_OUTPUT"
echo "matrix={\"test\":$(jq -c -n '$ARGS.positional' --args $(grep -r -l '^//go:build integration' integration backend/controller/cronjobs | xargs grep '^func Test' | awk '{print $2}' | cut -d'(' -f1))}" >> "$GITHUB_OUTPUT"
integration:
needs: prepare
runs-on: ubuntu-latest
Expand All @@ -42,4 +42,4 @@ jobs:
- name: Download Go Modules
run: go mod download
- name: Run ${{ matrix.test }}
run: go test -v -race -tags integration -run ${{ matrix.test }} ./integration/...
run: go test -v -race -tags integration -run ${{ matrix.test }} ./integration/... ./backend/controller/cronjobs

0 comments on commit 319798a

Please sign in to comment.