2020-08-16 12:20:57 +02:00
|
|
|
name: test
|
|
|
|
|
|
|
|
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]
|
2021-07-14 05:55:19 +02:00
|
|
|
go: ['1.15.14', '1.16.6', '1.17.0-rc1']
|
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:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go }}
|
2021-02-14 10:31:53 +01:00
|
|
|
stable: false
|
2020-08-16 12:20:57 +02:00
|
|
|
|
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
|
2020-08-19 15:00:11 +02:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2021-05-24 18:49:27 +02:00
|
|
|
sudo apt-get install libasound2-dev libgl1-mesa-dev libpulse-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
|
|
|
|
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
|
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
|
|
|
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
|
|
|
|
|
|
|
- name: go vet
|
2020-08-19 15:00:11 +02:00
|
|
|
if: ${{ matrix.os != 'windows-latest' }} # TODO: Fix go vet errors on Windows. (#1306)
|
2020-08-16 12:20:57 +02:00
|
|
|
run: |
|
|
|
|
go vet -tags=example -v ./...
|
|
|
|
|
|
|
|
- name: go build
|
|
|
|
run: |
|
|
|
|
go build -tags=example -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 ./...
|
|
|
|
|
|
|
|
- name: go test
|
2020-08-19 15:00:11 +02:00
|
|
|
if: ${{ matrix.os == 'ubuntu-latest' }} # TODO: Add more test environments (#1305)
|
2020-08-16 18:09:42 +02:00
|
|
|
run: |
|
2020-08-19 15:00:11 +02:00
|
|
|
go test -tags=example -v ./...
|
2020-08-16 18:09:42 +02:00
|
|
|
|
2020-08-19 15:00:11 +02:00
|
|
|
- name: go test (Wasm)
|
2021-03-26 18:34:50 +01:00
|
|
|
# TODO: Investigate times out on Windows. (#1313)
|
2021-04-10 14:49:25 +02:00
|
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
2020-08-16 18:09:42 +02:00
|
|
|
run: |
|
|
|
|
env GOOS=js GOARCH=wasm go test -tags=example -v ./...
|
2020-12-14 17:01:41 +01:00
|
|
|
env GOOS=js GOARCH=wasm go test -tags=example,ebitenwebgl1 -v ./...
|
2021-04-10 15:36:49 +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
|
|
|
|
ebitenmobile bind -target android -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)
|
|
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
|
|
run: |
|
2021-04-14 16:53:21 +02:00
|
|
|
cd /tmp/go-inovation
|
|
|
|
ebitenmobile bind -target ios -o Inovation.framework -v github.com/hajimehoshi/go-inovation/mobile
|