~eliasnaur/gio

acfe91ec3e33b65b4e6d8d266b66161596ac757d — Daniel Martí a month ago 49000ae
CI: add wine on Linux for the Windows e2e test

Installing it on Debian was enough, with the only wrinkle that
propagating -race won't work when we're cross-compiling, since
cross-compilation disables CGo by default.

For now, just skip the test in that edge case. If we want to use the
race detector on Windows in the future, we need to get a Windows CI
builder somehow.

Tested on my fork; see https://builds.sr.ht/~mvdan/job/164899.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
2 files changed, 6 insertions(+), 0 deletions(-)

M .builds/linux.yml
M cmd/gogio/windows_test.go
M .builds/linux.yml => .builds/linux.yml +1 -0
@@ 20,6 20,7 @@ packages:
 - scrot
 - sway
 - grim
 - wine
sources:
 - https://git.sr.ht/~eliasnaur/gio
environment:

M cmd/gogio/windows_test.go => cmd/gogio/windows_test.go +5 -0
@@ 11,6 11,7 @@ import (
	"os"
	"os/exec"
	"path/filepath"
	"runtime"
	"sync"
	"time"



@@ 39,6 40,10 @@ func (d *WineTestDriver) Start(path string) {
	bin := filepath.Join(d.tempDir("gio-endtoend-windows"), "red.exe")
	flags := []string{"build", "-o=" + bin}
	if raceEnabled {
		if runtime.GOOS != "windows" {
			// cross-compilation disables CGo, which breaks -race.
			d.Skipf("can't cross-compile -race for Windows; skipping")
		}
		flags = append(flags, "-race")
	}
	flags = append(flags, path)