build.sh: build windows/386 and linux/386, update Debian packaging (#193)

* feat(build.sh): build for windows/386

Part of https://github.com/ooni/probe/issues/1315

* fix(build.sh): docker pull so we have latest image

Part of https://github.com/ooni/probe/issues/1315

* fix(build.sh): apk update && apk upgrade to have latest packages

It does not currently seem necessary. But let's be defensive.

Part of https://github.com/ooni/probe/issues/1315.

* fix(windows.yml): for now disable windows/386

It's working locally but not remotely on Windows. We need to
figure out how to install the 386 compiler.

Part of https://github.com/ooni/probe/issues/1315.

* feat(build.sh): build for windows/386

Part of https://github.com/ooni/probe/issues/1315.

* fix(linux.yml): try to enable experimental docker flags

Related to https://github.com/ooni/probe/issues/1315.

See also https://github.com/actions/virtual-environments/issues/368#issuecomment-713588127.

* fix(debian): try to have single workflow with experimental docker

More commits probably needed.

Part of https://github.com/ooni/ooni.org/issues/677.

* remove restriction on the branch name

* maybe we need a pattern also for branches

* less stringent constraints

* consolidated debian workflow into a single workflow

* further fix the debian workflow

* only run debian action for specific branches or tags

* fix(build.sh): package the 386 windows version properly
This commit is contained in:
Simone Basso 2021-01-20 13:09:37 +01:00 committed by GitHub
commit 4b557a0899
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 89 additions and 82 deletions

View file

@ -6,6 +6,11 @@ v=`git describe --tags || echo $GITHUB_SHA`
case $1 in
windows)
$0 windows_amd64
$0 windows_386
;;
windows_amd64)
# Note! This assumes we've installed the mingw-w64 compiler.
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc \
go build -ldflags='-s -w' ./cmd/ooniprobe
@ -15,13 +20,38 @@ case $1 in
mv ooniprobe.exe ./CLI/windows/amd64/
;;
windows_386)
# Note! This assumes we've installed the mingw-w64 compiler.
GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc \
go build -ldflags='-s -w' ./cmd/ooniprobe
tar -cvzf ooniprobe_${v}_windows_386.tar.gz LICENSE.md Readme.md ooniprobe.exe
# We don't have zip inside the github actions runner
zip ooniprobe_${v}_windows_386.zip LICENSE.md Readme.md ooniprobe.exe || true
mv ooniprobe.exe ./CLI/windows/386/
;;
linux)
docker run -v`pwd`:/ooni -w/ooni golang:1.14-alpine ./build.sh _alpine
$0 linux_amd64
$0 linux_386
;;
linux_amd64)
docker pull --platform linux/amd64 golang:1.14-alpine
docker run --platform linux/amd64 -v`pwd`:/ooni -w/ooni golang:1.14-alpine ./build.sh _alpine
tar -cvzf ooniprobe_${v}_linux_amd64.tar.gz LICENSE.md Readme.md ooniprobe
mv ooniprobe ./CLI/linux/amd64/
;;
linux_386)
docker pull --platform linux/386 golang:1.14-alpine
docker run --platform linux/386 -v`pwd`:/ooni -w/ooni golang:1.14-alpine ./build.sh _alpine
tar -cvzf ooniprobe_${v}_linux_386.tar.gz LICENSE.md Readme.md ooniprobe
mv ooniprobe ./CLI/linux/386/
;;
_alpine)
apk update
apk upgrade
apk add --no-progress gcc git linux-headers musl-dev
go build -tags netgo -ldflags='-s -w -extldflags "-static"' ./cmd/ooniprobe
;;
@ -38,7 +68,7 @@ case $1 in
$0 linux
$0 windows
$0 darwin
shasum -a 256 ooniprobe_${v}_*_amd64.* > ooniprobe_checksums.txt
shasum -a 256 ooniprobe_${v}_*_*.* > ooniprobe_checksums.txt
;;
*)