2021-08-26 19:21:33 +02:00
|
|
|
name: Test
|
2020-08-16 12:20:57 +02:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
2020-08-19 15:00:11 +02:00
|
|
|
test:
|
2020-08-16 12:20:57 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-08-19 15:00:11 +02:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2022-08-02 19:15:32 +02:00
|
|
|
go: ['1.15.x', '1.16.x', '1.17.x', '1.18.x', '1.19.x']
|
2020-08-19 15:00:11 +02:00
|
|
|
name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
2020-08-16 12:20:57 +02:00
|
|
|
env:
|
|
|
|
DISPLAY: ':99.0'
|
2020-08-19 15:00:11 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
2020-08-16 12:20:57 +02:00
|
|
|
steps:
|
2022-03-18 12:45:03 +01:00
|
|
|
- name: Git
|
|
|
|
run: |
|
|
|
|
# See actions/checkout#135
|
|
|
|
git config --global core.autocrlf false
|
|
|
|
git config --global core.eol lf
|
|
|
|
|
2020-08-16 12:20:57 +02:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Go
|
2022-05-01 10:55:37 +02:00
|
|
|
uses: actions/setup-go@v3
|
2020-08-16 12:20:57 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2021-04-10 15:36:49 +02:00
|
|
|
- name: Setup JDK
|
|
|
|
uses: actions/setup-java@v2
|
|
|
|
with:
|
|
|
|
java-version: '11'
|
|
|
|
distribution: 'adopt'
|
|
|
|
|
2020-08-16 12:20:57 +02:00
|
|
|
- name: Install dependencies
|
2021-08-27 19:57:32 +02:00
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2021-08-16 20:07:21 +02:00
|
|
|
sudo apt-get install libasound2-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev
|
2020-08-19 15:00:11 +02:00
|
|
|
|
|
|
|
- name: Install wasmbrowsertest
|
|
|
|
run: |
|
2021-01-05 04:32:01 +01:00
|
|
|
# TODO: Use go install github.com/agnivade/wasmbrowsertest@... on Go 1.16 or later.
|
|
|
|
mkdir /tmp/wasmbrowsertest
|
|
|
|
cd /tmp/wasmbrowsertest
|
|
|
|
go mod init foo
|
2021-02-14 10:43:52 +01:00
|
|
|
go get github.com/agnivade/wasmbrowsertest
|
2021-01-05 04:32:01 +01:00
|
|
|
go build -o wasmbrowsertest github.com/agnivade/wasmbrowsertest
|
|
|
|
mv ./wasmbrowsertest $(go env GOPATH)/bin/go_js_wasm_exec
|
2020-08-16 12:20:57 +02:00
|
|
|
|
2021-04-14 16:53:21 +02:00
|
|
|
- name: Prepare ebitenmobile test
|
2021-08-20 21:22:08 +02:00
|
|
|
if: ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') }}
|
2021-04-14 16:53:21 +02:00
|
|
|
run: |
|
|
|
|
local_ebiten=$(pwd)
|
|
|
|
cd /tmp
|
|
|
|
git clone --depth=1 https://github.com/hajimehoshi/go-inovation
|
|
|
|
cd go-inovation
|
|
|
|
go mod edit -replace=github.com/hajimehoshi/ebiten/v2=$local_ebiten
|
|
|
|
go mod tidy
|
|
|
|
|
2020-08-19 15:00:11 +02:00
|
|
|
- name: Xvfb
|
2021-08-27 19:57:32 +02:00
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
|
|
|
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
|
|
|
|
|
|
|
- name: go vet
|
2021-08-27 19:57:32 +02:00
|
|
|
if: ${{ !startsWith(matrix.os, 'windows-') }} # TODO: Fix go vet errors on Windows. (#1306)
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
|
|
|
go vet -tags=example -v ./...
|
|
|
|
|
2021-08-27 19:32:24 +02:00
|
|
|
- name: go vet (atomic align)
|
|
|
|
run: |
|
|
|
|
go install .github/workflows/vettools/atomicalign.go
|
2021-08-27 19:45:01 +02:00
|
|
|
go vet -vettool=$(which atomicalign)${{ startsWith(matrix.os, 'windows-') && '.exe' || '' }} -tags=example -v ./...
|
2021-08-27 19:32:24 +02:00
|
|
|
|
2020-08-16 12:20:57 +02:00
|
|
|
- name: go build
|
|
|
|
run: |
|
|
|
|
go build -tags=example -v ./...
|
2022-06-04 10:45:59 +02:00
|
|
|
# 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 #2120.
|
|
|
|
go build -tags=example "-gcflags=all=-N -l" -v ./...
|
2020-08-16 21:12:31 +02:00
|
|
|
env GOOS=js GOARCH=wasm go build -tags=example -v ./...
|
2020-08-16 18:09:42 +02:00
|
|
|
env GOOS=windows GOARCH=amd64 go build -tags=example -v ./...
|
|
|
|
env GOOS=windows GOARCH=386 go build -tags=example -v ./...
|
|
|
|
|
2022-03-26 13:34:24 +01:00
|
|
|
- name: go build (macOS)
|
|
|
|
if: ${{ startsWith(matrix.os, 'macos-') && !startsWith(matrix.go, '1.15.') }}
|
|
|
|
run: |
|
|
|
|
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -tags=example -v ./...
|
|
|
|
env CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -tags=example -o flappy_amd64 -v ./examples/flappy
|
|
|
|
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -tags=example -o flappy_arm64 -v ./examples/flappy
|
|
|
|
lipo -create flappy_amd64 flappy_arm64 -output flappy
|
|
|
|
file flappy
|
|
|
|
rm flappy
|
|
|
|
|
2022-08-17 20:44:39 +02:00
|
|
|
- name: go build (NintendoSDK)
|
2022-08-18 05:23:36 +02:00
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
2022-02-13 08:57:48 +01:00
|
|
|
run: |
|
2022-08-17 20:44:39 +02:00
|
|
|
go build -tags=example,nintendosdk -v ./...
|
2022-07-09 08:19:47 +02:00
|
|
|
go build -tags=example,ebitencbackend -v ./... # For backward compatibility. Remove this in the future (#2190).
|
2022-02-13 08:57:48 +01:00
|
|
|
|
2021-09-22 12:50:03 +02:00
|
|
|
- name: go test
|
|
|
|
# TODO: Add more test environments (#1305)
|
2022-02-11 12:38:45 +01:00
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') || startsWith(matrix.os, 'windows-') }}
|
2021-09-22 12:50:03 +02:00
|
|
|
run: |
|
2022-03-18 11:45:14 +01:00
|
|
|
go test -tags=example ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v ./...
|
2021-09-22 12:50:03 +02:00
|
|
|
|
2022-05-20 11:36:44 +02:00
|
|
|
- name: go test (Linux 386)
|
|
|
|
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
|
|
|
|
run: |
|
|
|
|
sudo dpkg --add-architecture i386
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install gcc-multilib
|
|
|
|
sudo apt-get install libasound2-dev:i386 libgl1-mesa-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxinerama-dev:i386 libxrandr-dev:i386 libxxf86vm-dev:i386
|
|
|
|
env CGO_ENABLED=1 GOARCH=386 go test -tags=example ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v ./...
|
|
|
|
|
|
|
|
- name: go test (Windows 386)
|
|
|
|
if: ${{ startsWith(matrix.os, 'windows-') }}
|
|
|
|
run: |
|
|
|
|
# TODO: Enable this after DirectX is supported on 32bit machines (#2088)
|
|
|
|
# env GOARCH=386 go test -tags=example ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') && '-shuffle=on' || '' }} -v ./...
|
|
|
|
|
2021-09-22 12:50:03 +02:00
|
|
|
- name: go test (Wasm)
|
|
|
|
# TODO: Investigate times out on Windows. (#1313)
|
|
|
|
if: ${{ !startsWith(matrix.os, 'windows-') && !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') }}
|
|
|
|
run: |
|
2021-09-22 13:09:31 +02:00
|
|
|
# TODO: Add -shuffle=on after agnivade/wasmbrowsertest#23 is fixed.
|
|
|
|
env GOOS=js GOARCH=wasm go test -tags=example -v ./...
|
2022-07-09 08:32:37 +02:00
|
|
|
env GOOS=js GOARCH=wasm go test -tags=example,ebitenginewebgl1 -v ./...
|
2021-09-22 12:50:03 +02:00
|
|
|
|
2021-04-14 16:53:21 +02:00
|
|
|
- name: Install ebitenmobile
|
|
|
|
run: |
|
|
|
|
go install ./cmd/ebitenmobile
|
|
|
|
|
2021-04-10 15:36:49 +02:00
|
|
|
- name: ebitenmobile bind (Android)
|
2021-08-20 21:22:08 +02:00
|
|
|
if: ${{ !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') }}
|
2021-04-10 15:36:49 +02:00
|
|
|
run: |
|
2021-04-14 16:53:21 +02:00
|
|
|
cd /tmp/go-inovation
|
2022-08-02 18:34:48 +02:00
|
|
|
ebitenmobile bind -target android -androidapi 19 -javapkg com.hajimehoshi.goinovation -o inovation.aar -v github.com/hajimehoshi/go-inovation/mobile
|
2021-04-10 17:04:09 +02:00
|
|
|
|
|
|
|
- name: ebitenmobile bind (iOS)
|
2021-08-27 19:57:32 +02:00
|
|
|
if: ${{ startsWith(matrix.os, 'macos-') && !startsWith(matrix.go, '1.15.') && !startsWith(matrix.go, '1.16.') }}
|
2021-04-10 17:04:09 +02:00
|
|
|
run: |
|
2021-04-14 16:53:21 +02:00
|
|
|
cd /tmp/go-inovation
|
2022-01-04 18:27:17 +01:00
|
|
|
ebitenmobile bind -target ios -o Inovation.xcframework -v github.com/hajimehoshi/go-inovation/mobile
|