Enable experimental windows build

This commit is contained in:
Alessio 2024-02-19 23:25:28 -08:00
parent 6bfc7f78e1
commit e4d91f9cbd
6 changed files with 81 additions and 0 deletions

View File

@ -7,5 +7,7 @@ pipeline:
commands:
- cd .woodpecker/docker
- docker build -f go.dockerfile -t offline-twitter/go .
- docker build -f go-mingw.dockerfile -t offline-twitter/go-mingw .
- docker build -f innosetup.dockerfile -t offline-twitter/innosetup .
volumes:
- /var/run/docker.sock:/var/run/docker.sock

View File

@ -38,6 +38,12 @@ pipeline:
- curl localhost:1000/cernovich > webserver_test_output.html
- jobs -p | xargs -I{} kill -- -{}
windows_build:
image: offline-twitter/go-mingw
commands:
- cd cmd
- ./windows-compile.sh
version_bump_test:
image: offline-twitter/go
when:
@ -71,5 +77,12 @@ pipeline:
- scp offline-twitter-engine_$${version}_all.deb aptrepo@apt.playfulpachyderm.com:/apt-repo/test-repo
- ssh aptrepo@apt.playfulpachyderm.com "cd ~/test-repo && ./update.sh"
windows_package:
image: offline-twitter/innosetup
commands:
- export version=$(echo $CI_COMMIT_BRANCH | grep -Poh "(?<=^release-)\d+\.\d+\.\d+")
- iscc.sh /Dversion=$version /Dexe_path=`winepath -w cmd/twitter.exe` build/windows/setup.iss
depends_on:
- build-docker

View File

@ -0,0 +1,9 @@
from golang:alpine
run apk add --no-cache git sqlite-libs sqlite-dev build-base mingw-w64-gcc curl vim
# Install golangci-lint
run curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /usr/local/go/bin v1.53.1
# Install project dependencies (so they don't have to be reinstalled on every CI run)
run git clone https://gitlab.com/offline-twitter/twitter_offline_engine.git && cd twitter_offline_engine && go install ./... && cd .. && rm -r twitter_offline_engine

View File

@ -0,0 +1,12 @@
# Inspired by: https://github.com/amake/innosetup-docker/
from ubuntu:jammy
run dpkg --add-architecture i386
run apt update
run apt install -y curl wine wine32 xvfb
run curl -SL "https://files.jrsoftware.org/is/6/innosetup-6.2.2.exe" -o is.exe
env DISPLAY ":99"
env WINEDEBUG "-all,err+all"
run xvfb-run wine is.exe /SP- /VERYSILENT /ALLUSERS /SUPPRESSMSGBOXES /DOWNLOADISCRYPT=1
copy iscc.sh /usr/bin/iscc.sh

29
.woodpecker/docker/iscc.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# Stolen from:
# https://github.com/amake/innosetup-docker under `opt/bin/iscc`
set -eu
escone() {
printf %s\\n "$1" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"
}
winpaths() {
for arg; do
if [ -e "$arg" ]; then
escone "$(winepath -w "$arg")"
else
escone "$arg"
fi
done
echo " "
}
# PROGFILES_PATH="$(winepath -u "$(wine cmd /c "echo %PROGRAMFILES%" | tr -d '\r')")"
PROGFILES_PATH="$(winepath -u "C:\Program Files")"
# Set args (`$@`) to the map of `winpaths` over the existing args
eval set -- "$(winpaths "$@")"
exec wine "${PROGFILES_PATH}/Inno Setup 6/ISCC.exe" "$@"

16
cmd/windows-compile.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
set -x
set -e
export CGO_ENABLED=1
export CC=x86_64-w64-mingw32-gcc
export GOOS=windows
export GOARCH=amd64
if [[ -z "$1" ]]; then
echo "No version number given! Exiting..."
exit 1
fi
go build -ldflags="-linkmode external -extldflags -static -s -w -X main.version_string=$1 -X gitlab.com/offline-twitter/twitter_offline_engine/internal/webserver.use_embedded=true" -buildvcs=false -o twitter.exe ./twitter