.github/workflows: add test.yml (#30)
Closes #21
- commit
- 0acfce66fb4a57fbb5d952a80383b1e265912cc1
- author
- Hajime Hoshi · · 2022-08-29 19:24 UTC
- committer
- GitHub · · 2022-08-29 19:24 UTC
- parent
- 47b8ab8
- signature
- GPG Unverified
4AEE18F83AFDEB23The key is unknown
2 files · +63 -0
A .github/workflows/test.yml +62 -0
| @@ -0,0 +1,62 @@ | |||
| 1 | + | name: Test | |
| 2 | + | ||
| 3 | + | on: [push, pull_request] | |
| 4 | + | ||
| 5 | + | jobs: | |
| 6 | + | test: | |
| 7 | + | strategy: | |
| 8 | + | matrix: | |
| 9 | + | os: [ubuntu-latest, macos-latest, windows-latest] | |
| 10 | + | go: ['1.15.x', '1.16.x', '1.17.x', '1.18.x', '1.19.x'] | |
| 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: ${{ !startsWith(matrix.os, 'windows-') && !startsWith(matrix.os, 'macos-') }} | |
| 33 | + | run: | | |
| 34 | + | go vet -tags=example -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 | + | ||
| 49 | + | # Check cross-compiling macOS binaries. | |
| 50 | + | env GOOS=darwin GOARCH=amd64 go build -v ./... | |
| 51 | + | env GOOS=darwin GOARCH=arm64 go build -v ./... | |
| 52 | + | ||
| 53 | + | - name: go build (Windows, ARM64) | |
| 54 | + | if: ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') }} | |
| 55 | + | run: | | |
| 56 | + | # Check cross-compiling Windows binaries. | |
| 57 | + | env GOOS=windows GOARCH=arm64 go build -v ./... | |
| 58 | + | ||
| 59 | + | - name: go test | |
| 60 | + | if: ${{ !startsWith(matrix.go, '1.15.') }} # TODO: Remove this condition after #27 is fixed. | |
| 61 | + | run: | | |
| 62 | + | go test -tags=example ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v -count=10 ./... | |
| @@ -0,0 +1,62 @@ | |||||
| 1 | + | name: Test | |||
| 2 | + | ||||
| 3 | + | on: [push, pull_request] | |||
| 4 | + | ||||
| 5 | + | jobs: | |||
| 6 | + | test: | |||
| 7 | + | strategy: | |||
| 8 | + | matrix: | |||
| 9 | + | os: [ubuntu-latest, macos-latest, windows-latest] | |||
| 10 | + | go: ['1.15.x', '1.16.x', '1.17.x', '1.18.x', '1.19.x'] | |||
| 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: ${{ !startsWith(matrix.os, 'windows-') && !startsWith(matrix.os, 'macos-') }} | |||
| 33 | + | run: | | |||
| 34 | + | go vet -tags=example -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 | + | ||||
| 49 | + | # Check cross-compiling macOS binaries. | |||
| 50 | + | env GOOS=darwin GOARCH=amd64 go build -v ./... | |||
| 51 | + | env GOOS=darwin GOARCH=arm64 go build -v ./... | |||
| 52 | + | ||||
| 53 | + | - name: go build (Windows, ARM64) | |||
| 54 | + | if: ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') }} | |||
| 55 | + | run: | | |||
| 56 | + | # Check cross-compiling Windows binaries. | |||
| 57 | + | env GOOS=windows GOARCH=arm64 go build -v ./... | |||
| 58 | + | ||||
| 59 | + | - name: go test | |||
| 60 | + | if: ${{ !startsWith(matrix.go, '1.15.') }} # TODO: Remove this condition after #27 is fixed. | |||
| 61 | + | run: | | |||
| 62 | + | go test -tags=example ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v -count=10 ./... | |||
A .gitignore +1 -0
| @@ -0,0 +1,1 @@ | |||
| 1 | + | *~ | |
| @@ -0,0 +1,1 @@ | |||||
| 1 | + | *~ | |||