forked from quic-go/quic-go
ci: run go build jobs in parallel in cross compile job
This commit is contained in:
25
.github/workflows/cross-compile.sh
vendored
25
.github/workflows/cross-compile.sh
vendored
@@ -2,16 +2,17 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
for dist in $(go tool dist list); do
|
dist="$1"
|
||||||
goos=$(echo $dist | cut -d "/" -f1)
|
goos=$(echo "$dist" | cut -d "/" -f1)
|
||||||
goarch=$(echo $dist | cut -d "/" -f2)
|
goarch=$(echo "$dist" | cut -d "/" -f2)
|
||||||
# cross-compiling for android is a pain...
|
|
||||||
if [[ "$goos" == "android" ]]; then continue; fi
|
|
||||||
# iOS builds require Cgo, see https://github.com/golang/go/issues/43343
|
|
||||||
# Cgo would then need a C cross compilation setup. Not worth the hassle.
|
|
||||||
if [[ "$goos" == "ios" ]]; then continue; fi
|
|
||||||
|
|
||||||
echo "$dist"
|
# cross-compiling for android is a pain...
|
||||||
GOOS=$goos GOARCH=$goarch go build -o main example/main.go
|
if [[ "$goos" == "android" ]]; then exit; fi
|
||||||
rm main
|
# iOS builds require Cgo, see https://github.com/golang/go/issues/43343
|
||||||
done
|
# Cgo would then need a C cross compilation setup. Not worth the hassle.
|
||||||
|
if [[ "$goos" == "ios" ]]; then exit; fi
|
||||||
|
|
||||||
|
echo "$dist"
|
||||||
|
out="main-$goos-$goarch"
|
||||||
|
GOOS=$goos GOARCH=$goarch go build -o $out example/main.go
|
||||||
|
rm $out
|
||||||
|
|||||||
3
.github/workflows/cross-compile.yml
vendored
3
.github/workflows/cross-compile.yml
vendored
@@ -19,4 +19,5 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: go build example/main.go
|
run: go build example/main.go
|
||||||
- name: Run cross compilation
|
- name: Run cross compilation
|
||||||
run: .github/workflows/cross-compile.sh
|
# run in parallel on as many cores as are available on the machine
|
||||||
|
run: go tool dist list | xargs -I % -P "$(nproc)" .github/workflows/cross-compile.sh %
|
||||||
|
|||||||
Reference in New Issue
Block a user