Skip to content

Commit 4ed9170

Browse files
thaJeztahjeffwidman
authored andcommitted
gha: add basic test
Test against the "oldest" supported version and the current version of go. Go 1.17 is kept in this matrix as it is the minimum version specified in go.mod, and maintaining compatibility with go 1.17 is currently not much of a burden. Most projects using this module are using newer versions than that, so we can drop the old version if it becomes too much of a burden. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 8590eae commit 4ed9170

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

Diff for: .github/workflows/test.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: test
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- master
8+
- main
9+
pull_request:
10+
branches:
11+
- master
12+
- main
13+
14+
jobs:
15+
test:
16+
permissions:
17+
contents: read # for actions/checkout to fetch code
18+
timeout-minutes: 10
19+
20+
strategy:
21+
matrix:
22+
# test against the "oldest" supported version and the current version
23+
# of go. Go 1.17 is kept in this matrix as it is the minimum version
24+
# specified in go.mod, and maintaining compatibility with go 1.17 is
25+
# currently not much of a burden. Most projects using this module are
26+
# using newer versions than that, so we can drop the old version if
27+
# it becomes too much of a burden.
28+
go-version: [1.17.x, stable]
29+
os: [ubuntu-20.04, ubuntu-22.04, windows-2022]
30+
runs-on: ${{ matrix.os }}
31+
steps:
32+
- name: Install Go
33+
uses: actions/setup-go@v3
34+
with:
35+
go-version: ${{ matrix.go-version }}
36+
- name: Checkout code
37+
uses: actions/checkout@v3
38+
- name: go mod tidy
39+
run: |
40+
go mod tidy
41+
git diff --exit-code
42+
- name: Test
43+
run: |
44+
go test -exec "sudo -n" -v ./...
45+

0 commit comments

Comments
 (0)