Use captain for test aggregation (#3328)

* Use captain for test aggregation

* no retries
This commit is contained in:
Dustin Decker 2024-09-24 11:51:52 -07:00 committed by GitHub
parent b612e1e4fd
commit 3b0f2fcf39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 30 deletions

11
.captain/config.yaml Normal file
View file

@ -0,0 +1,11 @@
test-suites:
detectors:
command: gotestsum --jsonfile tmp/go-test.json --raw-command -- go test -tags=detectors -timeout=15m -json -count=1 -vet=off ./pkg/detectors
results:
path: tmp/go-test.json
output:
print-summary: true
## No retries right now
# retries:
# attempts: 3
# command: gotestsum --raw-command --jsonfile tmp/go-test.json -- go test -tags=detectors -timeout=15m -json -count=1 -vet=off {{ package }} -run '{{ run }}'

View file

@ -14,35 +14,16 @@ jobs:
contents: "read"
id-token: "write"
steps:
- name: Install Go
uses: actions/setup-go@v5
- uses: actions/setup-go@v5
- uses: actions/checkout@v4
- name: Install gotestsum
uses: jaxxstorm/action-install-gh-release@v1.12.0
with:
go-version: "1.22"
- name: Checkout code
uses: actions/checkout@v4
- id: "auth"
uses: "google-github-actions/auth@v2"
with:
workload_identity_provider: "projects/811013774421/locations/global/workloadIdentityPools/github-pool/providers/github-provider"
service_account: "github-ci-external@trufflehog-testing.iam.gserviceaccount.com"
- name: Test integration
continue-on-error: true
run: make test-integration
- name: Set up gotestsum
repo: gotestyourself/gotestsum
- uses: rwx-research/setup-captain@v1
- name: Test Go
run: |
go install gotest.tools/gotestsum@latest
mkdir -p tmp/test-results
- name: Test detectors
run: |
CGO_ENABLED=1 gotestsum --junitfile tmp/test-results/test.xml --raw-command -- go test -json -tags=detectors -timeout=15m $(go list ./... | grep pkg/detectors)
- name: Upload test results to BuildPulse for flaky test detection
if: ${{ !cancelled() }} # Run this step even when the tests fail. Skip if the workflow is cancelled.
uses: buildpulse/buildpulse-action@main
with:
account: 79229934
repository: 694446374
path: |
tmp/test-results/*.xml
key: ${{ secrets.BUILDPULSE_DETECTORS_ACCESS_KEY_ID }}
secret: ${{ secrets.BUILDPULSE_DETECTORS_SECRET_ACCESS_KEY }}
tags: detectors
export CGO_ENABLED=1
captain run detectors
env:
RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}