Skip to content

Commit 1166770

Browse files
committed
Run macOS/Windows tests only on main
1 parent ca03ac8 commit 1166770

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/go-ci.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,26 @@ jobs:
1111
go-test:
1212
strategy:
1313
matrix:
14-
os: [ubuntu-latest, macos-latest, windows-latest]
14+
os: [ubuntu-latest]
15+
runs-on: ${{ matrix.os }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Set up Go
20+
uses: actions/setup-go@v6.1.0
21+
with:
22+
go-version-file: '.tool-versions'
23+
- name: Enable pulling Go modules from private sourcegraph/sourcegraph
24+
run: git config --global url."https://${PRIVATE_TOKEN}@github.com/sourcegraph/".insteadOf "https://github.com/sourcegraph/"
25+
- run: |
26+
go test -race -v ./...
27+
go test -v ./...
28+
29+
go-test-macos-windows:
30+
if: github.ref == 'refs/heads/main'
31+
strategy:
32+
matrix:
33+
os: [macos-latest, windows-latest]
1534
runs-on: ${{ matrix.os }}
1635
steps:
1736
- name: Checkout
@@ -34,13 +53,17 @@ jobs:
3453
# It will only pass if all Go CI matrix tests above pass
3554
go-test-complete:
3655
runs-on: ubuntu-latest
37-
needs: go-test
56+
needs: [go-test, go-test-macos-windows]
3857
if: always()
3958
steps:
4059
- name: Check Go CI results
4160
run: |
4261
if [[ "${{ needs.go-test.result }}" != "success" ]]; then
43-
echo "One or more Go CI tests failed"
62+
echo "Go tests failed"
63+
exit 1
64+
fi
65+
if [[ "${{ needs.go-test-macos-windows.result }}" != "success" && "${{ needs.go-test-macos-windows.result }}" != "skipped" ]]; then
66+
echo "macOS/Windows tests failed"
4467
exit 1
4568
fi
4669
echo "All Go CI tests passed"

0 commit comments

Comments
 (0)