v0.11.0-alpha.2 fa49e74

test.yml RawHistoryFolder

1name: Test
2
3on: [push, pull_request]
4
5env:
6  QEMU_MAJOR_VERSION: "10"
7
8jobs:
9  test:
10    strategy:
11      matrix:
12        os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, windows-latest]
13        go: ['1.18.x', '1.19.x', '1.20.x', '1.21.x', '1.22.x', '1.23.x', '1.24.x', '1.25.x', '1.26.x']
14    name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
15    runs-on: ${{ matrix.os }}
16    defaults:
17      run:
18        shell: bash
19    steps:
20      - name: Git
21        run: |
22          # See actions/checkout#135
23          git config --global core.autocrlf false
24          git config --global core.eol lf
25
26      - name: Checkout
27        uses: actions/checkout@v5
28
29      - name: Setup Go
30        uses: actions/setup-go@v6
31        with:
32          go-version: ${{ matrix.go }}
33
34      - name: Set up the prerequisites
35        if: runner.os == 'Windows'
36        uses: msys2/setup-msys2@v2
37
38      - name: go vet
39        run: |
40          env CGO_ENABLED=0 go vet -v ./...
41
42      - name: gofmt
43        run: test -z "$(gofmt -s -l .)"
44
45      - name: go build
46        run: |
47          go build -v ./...
48          # Compile without optimization to check potential stack overflow.
49          # The option '-gcflags=all=-N -l' is often used at Visual Studio Code.
50          # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch and the issue hajimehoshi/ebiten#2120.
51          go build "-gcflags=all=-N -l" -v ./...
52
53          # Check cross-compiling Windows binaries.
54          env GOOS=windows GOARCH=386 go build -v ./...
55          env GOOS=windows GOARCH=amd64 go build -v ./...
56          env GOOS=windows GOARCH=arm64 go build -v ./...
57
58          # Check cross-compiling macOS binaries.
59          env GOOS=darwin GOARCH=amd64 go build -v ./...
60          env GOOS=darwin GOARCH=arm64 go build -v ./...
61
62          # Check cross-compiling Linux binaries.
63          env GOOS=linux GOARCH=amd64 go build -v ./...
64          env GOOS=linux GOARCH=arm64 go build -v ./...
65
66          # Check cross-compiling FreeBSD binaries.
67          # gcflags -std is necessary to make fakecgo the Cgo for
68          # FreeBSD to add the symbols that libc.so depends on.
69          env GOOS=freebsd GOARCH=amd64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...
70          env GOOS=freebsd GOARCH=arm64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...          
71          
72          # Check cross-compiling NetBSD binaries.
73          env GOOS=netbsd GOARCH=amd64 go build -v ./...
74          env GOOS=netbsd GOARCH=arm64 go build -v ./...
75
76      - name: go build (Linux minor architectures)
77        # Test them only on the latest Go to reduce CI time.
78        # s390x cannot be tested here as it requires Cgo.
79        if: startsWith(matrix.go, '1.26.')
80        run: |
81          # Check cross-compiling Linux binaries for minor architectures.
82          env GOOS=linux GOARCH=loong64 go build -v ./...
83          env GOOS=linux GOARCH=ppc64le go build -v ./...
84          env GOOS=linux GOARCH=riscv64 go build -v ./...
85
86      - name: go build (plugin)
87        if: runner.os == 'Linux' || runner.os == 'macOS'
88        run:
89          # Make sure that plugin buildmode works since we save the R15 register (#254)
90          go build -buildmode=plugin ./examples/libc
91
92      - name: go mod vendor
93        if: runner.os != 'Linux'
94        run: |
95          mkdir /tmp/vendoring
96          cd /tmp/vendoring
97          go mod init foo
98          echo 'package main' > main.go
99          echo 'import (' >> main.go
100          echo '  _ "github.com/ebitengine/purego"' >> main.go
101          echo ')' >> main.go
102          echo 'func main() {}' >> main.go
103          go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE
104          go mod tidy
105          go mod vendor
106          go build -v .
107
108      - name: go test
109        run: |
110          env CGO_ENABLED=0 go test -shuffle=on -v -count=10 ./...
111          env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./...
112          # Compile without optimization to check potential stack overflow.
113          # The option '-gcflags=all=-N -l' is often used at Visual Studio Code.
114          # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch.
115          env CGO_ENABLED=0 go test "-gcflags=all=-N -l" -v ./...
116          env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./...
117
118      - name: go test (Windows 386)
119        if: runner.os == 'Windows'
120        run: |
121          env CGO_ENABLED=0 GOARCH=386 go test -shuffle=on -v -count=10 ./...
122          env CGO_ENABLED=1 GOARCH=386 go test -shuffle=on -v -count=10 ./...
123
124      - name: go test (Linux 386)
125        if: ${{ runner.os == 'Linux' && runner.arch != 'ARM64' }}
126        run: |
127           sudo apt-get update
128           sudo apt-get install gcc-multilib
129           sudo apt-get install g++-multilib
130           env CGO_ENABLED=0 GOARCH=386 go test -shuffle=on -v -count=10 ./...
131           env CGO_ENABLED=1 GOARCH=386 go test -shuffle=on -v -count=10 ./...
132      
133      - name: go test (Linux arm)
134        if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
135        run: |
136           sudo apt-get update
137           sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross
138
139           # Install the latest QEMU 10.x package from Debian. Ubuntu 24.04 ships QEMU 8.2
140           # which has a bug where inter-thread signal delivery (tgkill) hangs,
141           # causing TestSetuidEtc to deadlock.
142           arch=$(dpkg --print-architecture)
143           qemu_user_deb=$(
144             curl -fsSL https://ftp.debian.org/debian/pool/main/q/qemu/ |
145               grep -Eo "qemu-user_${QEMU_MAJOR_VERSION}\.[0-9.]+\+ds-[0-9]+([+~][A-Za-z0-9.+:~-]+)*_${arch}\.deb" |
146               sort -V |
147               tail -n 1
148           )
149           if [ -z "${qemu_user_deb}" ]; then
150             echo "missing qemu-user ${QEMU_MAJOR_VERSION}.x package for ${arch}" >&2
151             exit 1
152           fi
153           wget -q "https://ftp.debian.org/debian/pool/main/q/qemu/${qemu_user_deb}" -O /tmp/qemu-user.deb
154           sudo dpkg --force-depends -i /tmp/qemu-user.deb
155           sudo apt-get -f install -y
156
157           # Create symlink for the dynamic linker that QEMU expects
158           sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3
159           go env -w CC=arm-linux-gnueabihf-gcc
160           go env -w CXX=arm-linux-gnueabihf-g++
161           env GOOS=linux GOARCH=arm CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
162           env QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf qemu-arm ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
163           env GOOS=linux GOARCH=arm CGO_ENABLED=1 go test -c -o=purego-test-cgo .
164           env QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf qemu-arm ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
165           go env -u CC
166           go env -u CXX
167
168      - name: go test race (no Cgo)
169        if: ${{ runner.os == 'macOS' &&  !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }}
170        run: |
171          # -race usually requires Cgo, but macOS is an exception. See https://go.dev/doc/articles/race_detector#Requirements
172          env CGO_ENABLED=0 go test -race -shuffle=on -v -count=10 ./...
173
174      - name: go test race (Cgo)
175        if: ${{ !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }}
176        run: |
177          env CGO_ENABLED=1 go test -race -shuffle=on -v -count=10 ./...
178
179  minor-arches:
180    strategy:
181      matrix:
182        # Test only the latest two Go versions to save CI time.
183        # See https://go.dev/doc/devel/release#policy
184        go: ['1.25.x', '1.26.x']
185    name: Test with Go ${{ matrix.go }} on Linux minor architectures
186    runs-on: ubuntu-latest
187    defaults:
188      run:
189        shell: bash
190    steps:
191      - name: Checkout
192        uses: actions/checkout@v5
193
194      - name: Setup Go
195        uses: actions/setup-go@v6
196        with:
197          go-version: ${{ matrix.go }}
198
199      - name: Set up the prerequisites
200        run: |
201          sudo apt-get update
202          sudo apt-get install -y \
203            gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu \
204            gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \
205            gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
206            gcc-s390x-linux-gnu g++-s390x-linux-gnu
207
208          # Install the latest QEMU 10.x package from Debian. Ubuntu 24.04 ships QEMU 8.2
209          # which has a bug where inter-thread signal delivery (tgkill) hangs,
210          # causing TestSetuidEtc to deadlock.
211          arch=$(dpkg --print-architecture)
212          qemu_user_deb=$(
213            curl -fsSL https://ftp.debian.org/debian/pool/main/q/qemu/ |
214              grep -Eo "qemu-user_${QEMU_MAJOR_VERSION}\.[0-9.]+\+ds-[0-9]+([+~][A-Za-z0-9.+:~-]+)*_${arch}\.deb" |
215              sort -V |
216              tail -n 1
217          )
218          if [ -z "${qemu_user_deb}" ]; then
219            echo "missing qemu-user ${QEMU_MAJOR_VERSION}.x package for ${arch}" >&2
220            exit 1
221          fi
222          wget -q "https://ftp.debian.org/debian/pool/main/q/qemu/${qemu_user_deb}" -O /tmp/qemu-user.deb
223          sudo dpkg --force-depends -i /tmp/qemu-user.deb
224          sudo apt-get -f install -y
225
226          # Verify that the expected QEMU binaries are installed and usable.
227          qemu-loongarch64 --version
228          qemu-ppc64le --version
229          qemu-riscv64 --version
230          qemu-s390x --version
231
232      - name: go test (Linux loong64)
233        run: |
234          go env -w CC=loongarch64-linux-gnu-gcc-14
235          go env -w CXX=loongarch64-linux-gnu-g++-14
236          env GOOS=linux GOARCH=loong64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
237          env QEMU_LD_PREFIX=/usr/loongarch64-linux-gnu qemu-loongarch64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
238          env GOOS=linux GOARCH=loong64 CGO_ENABLED=1 go test -c -o=purego-test-cgo .
239          env QEMU_LD_PREFIX=/usr/loongarch64-linux-gnu qemu-loongarch64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
240          go env -u CC
241          go env -u CXX
242
243      - name: go test (Linux ppc64le)
244        run: |
245          go env -w CC=powerpc64le-linux-gnu-gcc
246          go env -w CXX=powerpc64le-linux-gnu-g++
247          env GOOS=linux GOARCH=ppc64le CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
248          env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
249          env GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go test -c -o=purego-test-cgo .
250          env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
251          go env -u CC
252          go env -u CXX
253
254      - name: go test (Linux riscv64)
255        run: |
256          go env -w CC=riscv64-linux-gnu-gcc
257          go env -w CXX=riscv64-linux-gnu-g++
258          # Create symlink for the dynamic linker that QEMU expects
259          sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld.so.1
260          env GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
261          env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
262          env GOOS=linux GOARCH=riscv64 CGO_ENABLED=1 go test -c -o=purego-test-cgo .
263          env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
264          go env -u CC
265          go env -u CXX
266
267      - name: go test (Linux s390x)
268        run: |
269          go env -w CC=s390x-linux-gnu-gcc
270          go env -w CXX=s390x-linux-gnu-g++
271          env GOOS=linux GOARCH=s390x CGO_ENABLED=1 go test -c -o=purego-test-cgo .
272          env QEMU_LD_PREFIX=/usr/s390x-linux-gnu qemu-s390x ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
273          go env -u CC
274          go env -u CXX
275
276  bsd:
277    strategy:
278      matrix:
279        os: ['FreeBSD', 'NetBSD']
280        # Test only the latest two Go versions to save CI time.
281        # See https://go.dev/doc/devel/release#policy
282        go: ['1.25.8', '1.26.1']
283    name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
284    runs-on: ubuntu-22.04
285    defaults:
286      run:
287        shell: bash
288    steps:
289      - uses: actions/checkout@v5
290      - name: Run in FreeBSD
291        if: matrix.os == 'FreeBSD'
292        uses: vmactions/freebsd-vm@v1
293        with:
294          usesh: true
295          prepare: |
296            fetch https://go.dev/dl/go${{matrix.go}}.freebsd-amd64.tar.gz
297            rm -fr /usr/local/go && tar -C /usr/local -xf go${{matrix.go}}.freebsd-amd64.tar.gz
298            chmod +x $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
299          run: $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
300      - name: Run in NetBSD
301        if: matrix.os == 'NetBSD'
302        uses: vmactions/netbsd-vm@v1
303        with:
304          usesh: true
305          prepare: |
306            ftp https://go.dev/dl/go${{matrix.go}}.netbsd-amd64.tar.gz
307            mkdir /usr/local
308            rm -fr /usr/local/go && tar -C /usr/local -xf go${{matrix.go}}.netbsd-amd64.tar.gz
309            chmod +x $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
310          run: $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close