Skip to content

Commit 8cd7407

Browse files
committed
chore: add test matrix workflow
Adds a common workflow to run Go tests with a matrix strategy to ensure cross-platform compatibility. Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent 7d7bd22 commit 8cd7407

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/go-test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# This workflow will run the tests across a matrix of operating systems.
3+
4+
name: Go Test
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
go-tests:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macos-latest, windows-latest]
21+
runs-on: ${{ matrix.os }}
22+
name: Go Tests (${{ matrix.os }})
23+
steps:
24+
- name: Checkout Repository
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
- name: Setup Go
27+
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
28+
with:
29+
go-version-file: go.mod
30+
- name: Run Tests
31+
shell: bash
32+
run: |
33+
echo "Testing with $(go env GOVERSION) on ${{ matrix.os }}"
34+
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
35+
go test -race -count 1 ./... -timeout=3m
36+
else
37+
go test -count 1 ./... -timeout=3m
38+
fi

0 commit comments

Comments
 (0)