test.yml RawHistoryFolder
1name: Test
2
3on: [push, pull_request]
4
5jobs:
6 test:
7 strategy:
8 matrix:
9 os: [ubuntu-latest, macos-latest, windows-latest]
10 go: ['1.18.x', '1.19.x', '1.20.x', '1.21.0-rc.3']
11 name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
12 runs-on: ${{ matrix.os }}
13 defaults:
14 run:
15 shell: bash
16 steps:
17 - name: Git
18 run: |
19 # See actions/checkout#135
20 git config --global core.autocrlf false
21 git config --global core.eol lf
22
23 - name: Checkout
24 uses: actions/checkout@v2
25
26 - name: Setup Go
27 uses: actions/setup-go@v3
28 with:
29 go-version: ${{ matrix.go }}
30
31 - name: go vet
32 if: runner.os != 'Windows' && runner.os != 'macOS'
33 run: |
34 go vet -v ./...
35
36 - name: go build
37 run: |
38 go build -v ./...
39 # Compile without optimization to check potential stack overflow.
40 # The option '-gcflags=all=-N -l' is often used at Visual Studio Code.
41 # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch and the issue hajimehoshi/ebiten#2120.
42 go build "-gcflags=all=-N -l" -v ./...
43
44 # Check cross-compiling Windows binaries.
45 env GOOS=windows GOARCH=386 go build -v ./...
46 env GOOS=windows GOARCH=amd64 go build -v ./...
47 env GOOS=windows GOARCH=arm go build -v ./...
48 env GOOS=windows GOARCH=arm64 go build -v ./...
49
50 # Check cross-compiling macOS binaries.
51 env GOOS=darwin GOARCH=amd64 go build -v ./...
52 env GOOS=darwin GOARCH=arm64 go build -v ./...
53
54 # Check cross-compiling Linux binaries.
55 env GOOS=linux GOARCH=amd64 go build -v ./...
56 env GOOS=linux GOARCH=arm64 go build -v ./...
57
58 - name: go mod vendor
59 if: runner.os != 'Linux'
60 run: |
61 mkdir /tmp/vendoring
62 cd /tmp/vendoring
63 go mod init foo
64 echo 'package main' > main.go
65 echo 'import (' >> main.go
66 echo ' _ "github.com/ebitengine/purego"' >> main.go
67 echo ')' >> main.go
68 echo 'func main() {}' >> main.go
69 go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE
70 go mod tidy
71 go mod vendor
72 go build -v .
73
74 - name: go test
75 run: |
76 env CGO_ENABLED=0 go test -shuffle=on -v -count=10 ./...
77 env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./...
78
79 # TODO: add Windows 386 tests
80
81 - name: go test race
82 if: ${{ !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }}
83 run: |
84 go test -race -shuffle=on -v -count=10 ./...