name: Test on: [push, pull_request] jobs: test: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] go: ['1.15.x', '1.16.x', '1.17.x', '1.18.x', '1.19.x'] name: Test with Go ${{ matrix.go }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} defaults: run: shell: bash steps: - name: Git run: | # See actions/checkout#135 git config --global core.autocrlf false git config --global core.eol lf - name: Checkout uses: actions/checkout@v2 - name: Setup Go uses: actions/setup-go@v3 with: go-version: ${{ matrix.go }} - name: go vet if: ${{ !startsWith(matrix.os, 'windows-') && !startsWith(matrix.os, 'macos-') }} run: | go vet -tags=example -v ./... - name: go build run: | go build -v ./... # Compile without optimization to check potential stack overflow. # The option '-gcflags=all=-N -l' is often used at Visual Studio Code. # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch and the issue hajimehoshi/ebiten#2120. go build "-gcflags=all=-N -l" -v ./... # Check cross-compiling Windows binaries. env GOOS=windows GOARCH=386 go build -v ./... env GOOS=windows GOARCH=amd64 go build -v ./... env GOOS=windows GOARCH=arm go build -v ./... # Check cross-compiling macOS binaries. env GOOS=darwin GOARCH=amd64 go build -v ./... - name: go build (Windows, ARM64) # Go 1.16 and older don't support the pair GOOS=windows and GOARCH=arm64. if: ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') }} run: | # Check cross-compiling Windows binaries. env GOOS=windows GOARCH=arm64 go build -v ./... - name: go build (macOS, ARM64) # Purego doesn't support the pair GOOS=darwin and GOARCH=arm64 with Go 1.15 so far (#37). if: ${{ !startsWith(matrix.go, '1.15.') }} run: | # Check cross-compiling macOS binaries. env GOOS=darwin GOARCH=arm64 go build -v ./... - name: go mod vendor if: ${{ !startsWith(matrix.os, 'ubuntu-') }} run: | mkdir /tmp/vendoring cd /tmp/vendoring go mod init foo echo 'package main' > main.go echo 'import (' >> main.go echo ' _ "github.com/ebitengine/purego"' >> main.go echo ')' >> main.go echo 'func main() {}' >> main.go go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE go mod tidy go mod vendor go build -v . - name: go test run: | go test ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v -count=10 ./...