Skip to content

Find, verify, and analyze leaked credentials

Update tests for forks so we don't fail on everything (#1475)

Zachary Rice0bbe62cec5e6
diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml
index c0a9d7730..1655a819f 100644
--- a/.github/workflows/performance.yml
+++ b/.github/workflows/performance.yml
@@ -4,6 +4,10 @@ on: [pull_request]
jobs:
speed:
+ # skip if PR is from a fork.
+ # TODO: this could probabaly be refactored a bit so that it runs on forks
+ if: ${{ ! github.event.pull_request.head.repo.fork }}
+
runs-on: ubuntu-latest
steps:
- name: Install Go
@@ -85,4 +89,4 @@ jobs:
then
echo "HEAD run time is at least 10% slower than PREVIOUS run time"
exit 1
- fi
\ No newline at end of file
+ fi
diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml
index 6d6d85810..70bfe7226 100644
--- a/.github/workflows/smoke.yml
+++ b/.github/workflows/smoke.yml
@@ -14,9 +14,6 @@ jobs:
go-version: '1.18'
- name: Checkout code
uses: actions/checkout@v3
- with:
- fetch-depth: 0
- ref: ${{ github.head_ref }}
- name: Smoke
run: |
set -e
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index cc7133014..e2d916196 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -11,6 +11,7 @@ on:
jobs:
test:
+ if: ${{ ! github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
permissions:
actions: 'read'
@@ -31,6 +32,7 @@ jobs:
- name: Test
run: make test-integration
test-detectors:
+ if: ${{ ! github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
permissions:
actions: 'read'
@@ -50,4 +52,19 @@ jobs:
service_account: '[email protected]'
- name: Test
run: make test-detectors
- continue-on-error: true
+ continue-on-error: true
+ test-fork:
+ if: ${{ github.event.pull_request.head.repo.fork }}
+ runs-on: ubuntu-latest
+ permissions:
+ actions: 'read'
+ contents: 'read'
+ steps:
+ - name: Install Go
+ uses: actions/setup-go@v4
+ with:
+ go-version: '1.20'
+ - name: Checkout code
+ uses: actions/checkout@v3
+ - name: Test
+ run: make test-forks
diff --git a/Makefile b/Makefile
index c77ab97c6..2740245bb 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,9 @@ test-race:
test-detectors:
CGO_ENABLED=0 go test -tags=detectors -timeout=5m $(shell go list ./... | grep pkg/detectors)
+test-forks:
+ CGO_ENABLED=0 go test -timeout=5m $(shell go list ./... | grep -v /vendor/ | grep -v pkg/detectors | grep -v pkg/sources)
+
bench:
CGO_ENABLED=0 go test $(shell go list ./pkg/secrets/... | grep -v /vendor/) -benchmem -run=xxx -bench .