diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30273d52..74a03aaf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,14 @@ + +name: Test + on: push: + tags: + - v* branches: - main pull_request: -name: Test + jobs: test: strategy: @@ -27,4 +32,29 @@ jobs: 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 - run: go test -timeout 30s ./... \ No newline at end of file + run: make test + test-detectors: + strategy: + matrix: + go-version: [1.17.x] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + permissions: + contents: 'read' + id-token: 'write' + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v2 + - id: 'auth' + uses: 'google-github-actions/auth@v0' + 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 + run: make test-detectors + continue-on-error: true + \ No newline at end of file diff --git a/Makefile b/Makefile index 2ab1b974..bef23551 100644 --- a/Makefile +++ b/Makefile @@ -20,10 +20,13 @@ test-failing: CGO_ENABLED=0 go test -timeout=30s $(shell go list ./... | grep -v /vendor/) | grep FAIL test: - CGO_ENABLED=0 go test -timeout=30s $(shell go list ./... | grep -v /vendor/) + CGO_ENABLED=0 go test -timeout=30s $(shell go list ./... | grep -v /vendor/ | grep -v /pkg/detectors) test-race: - CGO_ENABLED=1 go test -timeout=30s -race $(shell go list ./... | grep -v /vendor/) + CGO_ENABLED=1 go test -timeout=30s -race $(shell go list ./... | grep -v /vendor/ | grep -v /pkg/detectors) + +test-detectors: + CGO_ENABLED=0 go test -timeout=30s $(shell go list ./... | grep /pkg/detectors) bench: CGO_ENABLED=0 go test $(shell go list ./pkg/secrets/... | grep -v /vendor/) -benchmem -run=xxx -bench .