1111 - cron : " 30 10 * * 0"
1212
1313jobs :
14- test-windows :
14+ test-build :
1515 strategy :
1616 fail-fast : false
1717 matrix :
18+ os :
19+ - windows-latest
20+ - ubuntu-latest
21+ - macos-latest
1822 go-version :
23+ - " 1.18"
24+ - " 1.19"
25+ - " 1.20"
1926 - " 1.21"
2027 - " 1.22"
28+ - " 1.23"
2129 - " ^1"
30+ runs-on : ${{ matrix.os }}
31+ steps :
32+ - uses : actions/checkout@v4
33+ - uses : actions/setup-go@v5
34+ with :
35+ go-version : ${{ matrix.go-version }}
36+ - name : go build check
37+ run : go build ./...
38+ - name : go test build check
39+ run : go test -run none ./...
40+
41+ test-windows :
42+ strategy :
43+ fail-fast : false
44+ matrix :
45+ go-version :
46+ - " 1.18"
47+ - " 1.20"
48+ - " 1.21"
49+ - " oldstable"
50+ - " stable"
2251 runs-on : windows-latest
2352 steps :
2453 - uses : actions/checkout@v4
2554 - uses : actions/setup-go@v5
2655 with :
2756 go-version : ${{ matrix.go-version }}
2857 - name : mkdir gocoverdir
58+ # We can only use -test.gocoverdir for Go >= 1.20.
59+ if : ${{ matrix.go-version != '1.18' && matrix.go-version != '1.19' }}
2960 run : |
3061 # mktemp --tmpdir -d gocoverdir.XXXXXXXX
3162 function New-TemporaryDirectory {
4273 $GOCOVERDIR = (New-TemporaryDirectory -Prefix "gocoverdir")
4374 echo "GOCOVERDIR=$GOCOVERDIR" >>"$env:GITHUB_ENV"
4475 - name : unit tests
45- run : go test -v -cover '-test.gocoverdir' "$env:GOCOVERDIR" ./...
76+ run : |
77+ if (Test-Path 'env:GOCOVERDIR') {
78+ go test -v -cover '-test.gocoverdir' "$env:GOCOVERDIR" ./...
79+ } else {
80+ go test -v ./...
81+ }
4682 - name : upload coverage
83+ # We can only use -test.gocoverdir for Go >= 1.20.
84+ if : ${{ matrix.go-version != '1.18' && matrix.go-version != '1.19' }}
4785 uses : actions/upload-artifact@v4
4886 with :
4987 name : coverage-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}
@@ -57,24 +95,30 @@ jobs:
5795 - ubuntu-latest
5896 - macos-latest
5997 go-version :
98+ - " 1.18"
99+ - " 1.20"
60100 - " 1.21"
61- - " 1.22 "
62- - " ^1 "
101+ - " oldstable "
102+ - " stable "
63103 runs-on : ${{ matrix.os }}
64104 steps :
65105 - uses : actions/checkout@v4
66106 - uses : actions/setup-go@v5
67107 with :
68108 go-version : ${{ matrix.go-version }}
69109 - name : mkdir gocoverdir
110+ # We can only use -test.gocoverdir for Go >= 1.20.
111+ if : ${{ matrix.go-version != '1.18' && matrix.go-version != '1.19' }}
70112 run : |
71113 GOCOVERDIR="$(mktemp --tmpdir -d gocoverdir.XXXXXXXX)"
72114 echo "GOCOVERDIR=$GOCOVERDIR" >>"$GITHUB_ENV"
73115 - name : go test
74- run : go test -v -cover - timeout=30m - test.gocoverdir="$GOCOVERDIR" ./...
116+ run : go test -v -timeout=30m ${GOCOVERDIR:+-cover - test.gocoverdir="$GOCOVERDIR"} ./...
75117 - name : sudo go test
76- run : sudo go test -v -cover - timeout=30m - test.gocoverdir="$GOCOVERDIR" ./...
118+ run : sudo go test -v -timeout=30m ${GOCOVERDIR:+-cover - test.gocoverdir="$GOCOVERDIR"} ./...
77119 - name : upload coverage
120+ # We can only use -test.gocoverdir for Go >= 1.20.
121+ if : ${{ matrix.go-version != '1.18' && matrix.go-version != '1.19' }}
78122 uses : actions/upload-artifact@v4
79123 with :
80124 name : coverage-${{ runner.os }}-${{ github.job }}-${{ strategy.job-index }}
89133 - uses : actions/checkout@v4
90134 - uses : actions/setup-go@v5
91135 with :
92- go-version : " ^1 "
136+ go-version : " stable "
93137 - name : download all coverage
94138 uses : actions/download-artifact@v4
95139 with :
0 commit comments