-
-
Notifications
You must be signed in to change notification settings - Fork 671
193 lines (165 loc) · 7.06 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Test
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.22.x', '1.23.x']
name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
DISPLAY: ':99.0'
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@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libasound2-dev libgl1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev
- name: Install Chrome
uses: browser-actions/setup-chrome@latest
- name: Install wasmbrowsertest
run: |
wasmbrowsertest_version=06679196c7e76f227e71456cdc16fccd6cc33601
go install github.com/agnivade/wasmbrowsertest@${wasmbrowsertest_version}
mv $(go env GOPATH)/bin/wasmbrowsertest${{ runner.os == 'Windows' && '.exe' || '' }} $(go env GOPATH)/bin/go_js_wasm_exec${{ runner.os == 'Windows' && '.exe' || '' }}
go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@${wasmbrowsertest_version}
- name: Prepare ebitenmobile test
run: |
cd /tmp
git clone --depth=1 https://github.com/hajimehoshi/go-inovation
cd go-inovation
go mod edit -replace=github.com/hajimehoshi/ebiten/v2=$GITHUB_WORKSPACE
go mod tidy
- name: Xvfb
if: runner.os == 'Linux'
run: |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
- 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'
run: |
go list ./... | grep -v -x -F -f .github/workflows/govetblock_windows.txt | xargs go vet
- name: go vet (vettool)
run: |
go install ./internal/vettools
go vet -vettool=$(which vettools)${{ runner.os == 'Windows' && '.exe' || '' }} -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 #2120.
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 ./...
- name: go build (macOS)
if: runner.os == 'macOS'
run: |
env CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 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
lipo -create flappy_amd64 flappy_arm64 -output flappy
file flappy
rm flappy
- name: go build (NintendoSDK)
if: runner.os == 'Linux'
run: |
go build -tags=nintendosdk -v ./...
- name: go build (PlayStation 5)
if: runner.os == 'Linux'
run: |
go build -tags=playstation5 -v ./...
- 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
go mod tidy
go mod vendor
go build -v .
- name: go test (Linux)
if: runner.os == 'Linux'
run: |
go test -shuffle=on -v -p=1 ./...
- name: go test (Linux 386)
if: runner.os == 'Linux'
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 -shuffle=on -v -p=1 ./...
- name: go test (Linux OpenGL ES)
if: runner.os == 'Linux'
run: |
sudo apt-get install libgles2-mesa-dev
env EBITENGINE_GRAPHICS_LIBRARY=opengl go test -shuffle=on -v -p=1 ./...
- name: go test (Windows)
if: runner.os == 'Windows'
run: |
go test -shuffle=on -v ./...
env EBITENGINE_DIRECTX=version=12 go test -shuffle=on -v ./...
- name: go test (Windows 386)
if: runner.os == 'Windows'
run: |
env GOARCH=386 go test -shuffle=on -v ./...
env GOARCH=386 EBITENGINE_DIRECTX=version=12 go test -shuffle=on -v ./...
- name: go test (Wasm)
if: runner.os == 'Linux'
run: |
# Disable AppArmor for Ubuntu 23.10+.
# https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
# Wasm tests don't work on macOS with the headless mode enabled, but the headless mode cannot be disabled in GitHub Actions (#2972).
# Wasm tests time out on Windows (#3076).
env GOOS=js GOARCH=wasm cleanenv -remove-prefix GITHUB_ -remove-prefix JAVA_ -remove-prefix PSModulePath -remove-prefix STATS_ -remove-prefix RUNNER_ -- go test -shuffle=on -v ./... -test.paniconexit0=false
- name: Install ebitenmobile
run: |
go install ./cmd/ebitenmobile
- name: ebitenmobile bind (Android)
run: |
cd /tmp/go-inovation
ebitenmobile bind -target android -androidapi 23 -javapkg com.hajimehoshi.goinovation -o inovation.aar -v github.com/hajimehoshi/go-inovation/mobile
- name: ebitenmobile bind (iOS)
if: runner.os == 'macOS'
run: |
cd /tmp/go-inovation
ebitenmobile bind -target ios -o Inovation.xcframework -v github.com/hajimehoshi/go-inovation/mobile