2021-08-26 19:21:33 +02:00
|
|
|
name: Test
|
2020-08-16 12:20:57 +02:00
|
|
|
|
2023-09-29 06:00:06 +02:00
|
|
|
on: [push, pull_request]
|
2020-08-16 12:20:57 +02:00
|
|
|
|
|
|
|
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]
|
2024-02-07 04:19:29 +01:00
|
|
|
go: ['1.18.x', '1.19.x', '1.20.x', '1.21.x', '1.22.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
|
2023-09-08 16:27:09 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-08-16 12:20:57 +02:00
|
|
|
|
|
|
|
- name: Setup Go
|
2023-09-08 16:27:09 +02:00
|
|
|
uses: actions/setup-go@v4
|
2020-08-16 12:20:57 +02:00
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
|
|
|
|
2021-04-10 15:36:49 +02:00
|
|
|
- name: Setup JDK
|
2023-09-08 16:27:09 +02:00
|
|
|
uses: actions/setup-java@v3
|
2021-04-10 15:36:49 +02:00
|
|
|
with:
|
|
|
|
java-version: '11'
|
|
|
|
distribution: 'adopt'
|
|
|
|
|
2020-08-16 12:20:57 +02:00
|
|
|
- name: Install dependencies
|
2022-11-12 07:44:06 +01:00
|
|
|
if: runner.os == 'Linux'
|
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: |
|
2023-02-07 16:19:50 +01:00
|
|
|
go install github.com/agnivade/wasmbrowsertest@bb77d443e302d06f0d2462336bc2765942e0e862
|
2022-11-12 07:44:06 +01:00
|
|
|
mv $(go env GOPATH)/bin/wasmbrowsertest${{ runner.os == 'Windows' && '.exe' || '' }} $(go env GOPATH)/bin/go_js_wasm_exec${{ runner.os == 'Windows' && '.exe' || '' }}
|
2023-02-07 16:19:50 +01:00
|
|
|
go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@bb77d443e302d06f0d2462336bc2765942e0e862
|
2020-08-16 12:20:57 +02:00
|
|
|
|
2021-04-14 16:53:21 +02:00
|
|
|
- name: Prepare ebitenmobile test
|
|
|
|
run: |
|
|
|
|
cd /tmp
|
|
|
|
git clone --depth=1 https://github.com/hajimehoshi/go-inovation
|
|
|
|
cd go-inovation
|
2022-11-12 07:44:06 +01:00
|
|
|
go mod edit -replace=github.com/hajimehoshi/ebiten/v2=$GITHUB_WORKSPACE
|
2023-09-01 19:11:48 +02:00
|
|
|
go mod tidy
|
2021-04-14 16:53:21 +02:00
|
|
|
|
2020-08-19 15:00:11 +02:00
|
|
|
- name: Xvfb
|
2022-11-12 07:44:06 +01:00
|
|
|
if: runner.os == 'Linux'
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
|
|
|
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
|
|
|
|
2023-10-04 19:23:51 +02:00
|
|
|
- name: go vet (Linux)
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
|
|
|
go vet ./...
|
|
|
|
|
|
|
|
- name: go vet (macOS)
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
|
|
|
go list ./... | grep -v -x -F -f .github/workflows/govetblock_darwin.txt | xargs go vet
|
|
|
|
|
|
|
|
- name: go vet (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
2023-10-04 19:23:51 +02:00
|
|
|
go list ./... | grep -v -x -F -f .github/workflows/govetblock_windows.txt | xargs go vet
|
2020-08-16 12:20:57 +02:00
|
|
|
|
2022-09-18 10:17:00 +02:00
|
|
|
- name: go vet (vettool)
|
2023-10-04 06:27:04 +02:00
|
|
|
# Stop vettools for old Go versions. Apparently this is an issue in golang.org/x/tools (golang/go#62519)
|
|
|
|
# TODO: Update golang.org/x/tools and remove this restriction.
|
|
|
|
if: ${{ !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }}
|
2021-08-27 19:32:24 +02:00
|
|
|
run: |
|
2023-10-04 05:17:41 +02:00
|
|
|
go install ./internal/vettools
|
2022-11-12 07:44:06 +01:00
|
|
|
go vet -vettool=$(which vettools)${{ runner.os == 'Windows' && '.exe' || '' }} -v ./...
|
2021-08-27 19:32:24 +02:00
|
|
|
|
2020-08-16 12:20:57 +02:00
|
|
|
- name: go build
|
|
|
|
run: |
|
2022-11-03 12:24:09 +01:00
|
|
|
go build -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.
|
2022-11-03 12:24:09 +01:00
|
|
|
go build "-gcflags=all=-N -l" -v ./...
|
|
|
|
env GOOS=js GOARCH=wasm go build -v ./...
|
|
|
|
env GOOS=windows GOARCH=386 go build -v ./...
|
|
|
|
env GOOS=windows GOARCH=amd64 go build -v ./...
|
|
|
|
env GOOS=windows GOARCH=arm go build -v ./...
|
|
|
|
env GOOS=windows GOARCH=arm64 go build -v ./...
|
2020-08-16 18:09:42 +02:00
|
|
|
|
2022-03-26 13:34:24 +01:00
|
|
|
- name: go build (macOS)
|
2022-11-12 07:44:06 +01:00
|
|
|
if: runner.os == 'macOS'
|
2022-03-26 13:34:24 +01:00
|
|
|
run: |
|
2022-11-03 12:24:09 +01:00
|
|
|
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -v ./...
|
|
|
|
env CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o flappy_amd64 -v ./examples/flappy
|
|
|
|
env CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o flappy_arm64 -v ./examples/flappy
|
2022-03-26 13:34:24 +01:00
|
|
|
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-11-12 07:44:06 +01:00
|
|
|
if: runner.os == 'Linux'
|
2022-02-13 08:57:48 +01:00
|
|
|
run: |
|
2022-11-03 12:24:09 +01:00
|
|
|
go build -tags=nintendosdk -v ./...
|
2022-02-13 08:57:48 +01:00
|
|
|
|
2023-10-01 16:14:47 +02:00
|
|
|
- name: go build (PlayStation 5)
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
|
|
|
go build -tags=playstation5 -v ./...
|
|
|
|
|
2022-09-05 06:19:26 +02:00
|
|
|
- name: go mod vendor
|
|
|
|
run: |
|
|
|
|
mkdir /tmp/vendoring
|
|
|
|
cd /tmp/vendoring
|
|
|
|
go mod init foo
|
|
|
|
# TODO: Is there a way to create a complete list of Ebitengine sub-packages?
|
|
|
|
echo 'package main' > main.go
|
|
|
|
echo 'import (' >> main.go
|
|
|
|
echo ' _ "github.com/hajimehoshi/ebiten/v2"' >> main.go
|
|
|
|
echo ' _ "github.com/hajimehoshi/ebiten/v2/audio"' >> main.go
|
|
|
|
echo ')' >> main.go
|
|
|
|
echo 'func main() {}' >> main.go
|
|
|
|
go mod edit -replace github.com/hajimehoshi/ebiten/v2=$GITHUB_WORKSPACE
|
2023-09-01 19:11:48 +02:00
|
|
|
go mod tidy
|
2022-09-05 06:19:26 +02:00
|
|
|
go mod vendor
|
|
|
|
go build -v .
|
|
|
|
|
2023-03-29 08:23:51 +02:00
|
|
|
- name: go test (Linux)
|
|
|
|
if: runner.os == 'Linux'
|
2021-09-22 12:50:03 +02:00
|
|
|
run: |
|
2023-03-29 08:23:51 +02:00
|
|
|
go test -shuffle=on -v -p=1 ./...
|
2021-09-22 12:50:03 +02:00
|
|
|
|
2022-05-20 11:36:44 +02:00
|
|
|
- name: go test (Linux 386)
|
2023-05-28 17:17:37 +02:00
|
|
|
if: runner.os == 'Linux'
|
2022-05-20 11:36:44 +02:00
|
|
|
run: |
|
|
|
|
sudo dpkg --add-architecture i386
|
|
|
|
sudo apt-get update
|
2023-05-28 17:17:37 +02:00
|
|
|
sudo apt-get install ppa-purge
|
|
|
|
sudo ppa-purge -y ppa:ubuntu-toolchain-r/test # Hack for 32bit Linux (#2667)
|
2022-05-20 11:36:44 +02:00
|
|
|
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
|
2023-03-29 08:23:51 +02:00
|
|
|
env CGO_ENABLED=1 GOARCH=386 go test -shuffle=on -v -p=1 ./...
|
2022-05-20 11:36:44 +02:00
|
|
|
|
2022-09-12 16:28:43 +02:00
|
|
|
- name: go test (Linux OpenGL ES)
|
2022-11-12 07:44:06 +01:00
|
|
|
if: runner.os == 'Linux'
|
2022-09-12 16:28:43 +02:00
|
|
|
run: |
|
|
|
|
sudo apt-get install libgles2-mesa-dev
|
2023-03-29 08:23:51 +02:00
|
|
|
env EBITENGINE_GRAPHICS_LIBRARY=opengl EBITENGINE_OPENGL=es go test -shuffle=on -v -p=1 ./...
|
|
|
|
|
|
|
|
- name: go test (Windows)
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
run: |
|
|
|
|
go test -shuffle=on -v ./...
|
2023-03-27 07:14:22 +02:00
|
|
|
env EBITENGINE_DIRECTX=version=12 go test -shuffle=on -v ./...
|
2022-09-12 16:28:43 +02:00
|
|
|
|
2022-05-20 11:36:44 +02:00
|
|
|
- name: go test (Windows 386)
|
2022-11-12 07:44:06 +01:00
|
|
|
if: runner.os == 'Windows'
|
2022-05-20 11:36:44 +02:00
|
|
|
run: |
|
2022-11-03 12:24:09 +01:00
|
|
|
env GOARCH=386 go test -shuffle=on -v ./...
|
2023-03-27 07:14:22 +02:00
|
|
|
env GOARCH=386 EBITENGINE_DIRECTX=version=12 go test -shuffle=on -v ./...
|
2022-05-20 11:36:44 +02:00
|
|
|
|
2021-09-22 12:50:03 +02:00
|
|
|
- name: go test (Wasm)
|
|
|
|
run: |
|
2023-02-07 16:19:50 +01:00
|
|
|
env GOOS=js GOARCH=wasm cleanenv -remove-prefix GITHUB_ -remove-prefix JAVA_ -- go test -shuffle=on -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)
|
|
|
|
run: |
|
2021-04-14 16:53:21 +02:00
|
|
|
cd /tmp/go-inovation
|
2024-02-23 19:36:43 +01:00
|
|
|
ebitenmobile bind -target android -androidapi 23 -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)
|
2022-11-12 07:44:06 +01:00
|
|
|
if: runner.os == 'macOS'
|
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
|