Use parallel builds for release pipeline (#2172)
This commit is contained in:
1 parent
f4ae38f575
commit
73d7837cfc
3 files changed
+85
-97
No files matched your search
@@ -8,6 +8,47 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { os: android, arch: arm64 }
|
||||||
|
- { os: darwin, arch: amd64 }
|
||||||
|
- { os: darwin, arch: arm64 }
|
||||||
|
- { os: dragonfly, arch: amd64 }
|
||||||
|
- { os: freebsd, arch: "386" }
|
||||||
|
- { os: freebsd, arch: amd64 }
|
||||||
|
- { os: freebsd, arch: arm }
|
||||||
|
- { os: illumos, arch: amd64 }
|
||||||
|
- { os: linux, arch: "386" }
|
||||||
|
- { os: linux, arch: amd64 }
|
||||||
|
- { os: linux, arch: arm }
|
||||||
|
- { os: linux, arch: arm64 }
|
||||||
|
- { os: linux, arch: ppc64 }
|
||||||
|
- { os: linux, arch: ppc64le }
|
||||||
|
- { os: linux, arch: mips }
|
||||||
|
- { os: linux, arch: mipsle }
|
||||||
|
- { os: linux, arch: mips64 }
|
||||||
|
- { os: linux, arch: mips64le }
|
||||||
|
- { os: linux, arch: s390x }
|
||||||
|
- { os: netbsd, arch: "386" }
|
||||||
|
- { os: netbsd, arch: amd64 }
|
||||||
|
- { os: netbsd, arch: arm }
|
||||||
|
- { os: openbsd, arch: "386" }
|
||||||
|
- { os: openbsd, arch: amd64 }
|
||||||
|
- { os: openbsd, arch: arm }
|
||||||
|
- { os: openbsd, arch: arm64 }
|
||||||
|
- { os: solaris, arch: amd64 }
|
||||||
|
- { os: windows, arch: "386" }
|
||||||
|
- { os: windows, arch: amd64 }
|
||||||
|
# Unsupported
|
||||||
|
# - { os: aix, arch: ppc64 }
|
||||||
|
# - { os: android, arch: "386" }
|
||||||
|
# - { os: android, arch: amd64 }
|
||||||
|
# - { os: android, arch: arm }
|
||||||
|
# - { os: js, arch: wasm }
|
||||||
|
# - { os: plan9, arch: "386" }
|
||||||
|
# - { os: plan9, arch: amd64 }
|
||||||
|
# - { os: plan9, arch: arm }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
@@ -17,7 +58,32 @@ jobs:
|
|||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: gen/xbuild.sh
|
run: gen/build.sh
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.os }}
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
run: gen/package.sh
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.os }}
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: lf-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
|
path: dist/*
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Download artifacts
|
||||||
|
uses: actions/download-artifact@v5
|
||||||
|
with:
|
||||||
|
path: dist
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
|
|||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Compresses a binary into an archived form.
|
||||||
|
#
|
||||||
|
# This script is used to compress a binary built from `build.sh` into an
|
||||||
|
# archive. `.zip` is used for Windows and `.tar.gz` otherwise. The archive is
|
||||||
|
# placed inside a directory named `dist`.
|
||||||
|
|
||||||
|
set -o errexit -o nounset
|
||||||
|
|
||||||
|
mkdir -p dist
|
||||||
|
|
||||||
|
if [ "$GOOS" = "windows" ]; then
|
||||||
|
zip "dist/lf-${GOOS}-${GOARCH}.zip" lf.exe
|
||||||
|
else
|
||||||
|
tar czf "dist/lf-${GOOS}-${GOARCH}.tar.gz" lf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# vim: tabstop=4 shiftwidth=4 textwidth=80 colorcolumn=80
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Generates cross builds for all supported platforms.
|
|
||||||
#
|
|
||||||
# This script is used to build binaries for all supported platforms. Cgo is
|
|
||||||
# disabled to make sure binaries are statically linked. Appropriate flags are
|
|
||||||
# given to the go compiler to strip binaries. Current git tag is passed to the
|
|
||||||
# compiler by default to be used as the version in binaries. These are then
|
|
||||||
# compressed in an archive form (`.zip` for windows and `.tar.gz` for the rest)
|
|
||||||
# within a folder named `dist`.
|
|
||||||
|
|
||||||
set -o errexit -o nounset
|
|
||||||
|
|
||||||
[ -z "${version:-}" ] && version=$(git describe --tags --abbrev=0)
|
|
||||||
|
|
||||||
test -d dist && {
|
|
||||||
echo "gen/xbuild.sh: WARNING: removing preexisting subdir 'dist'"
|
|
||||||
rm -r dist || exit 5
|
|
||||||
}
|
|
||||||
mkdir dist || exit 5
|
|
||||||
|
|
||||||
ERRORS=
|
|
||||||
|
|
||||||
build() {
|
|
||||||
# https://golang.org/doc/install/source#environment
|
|
||||||
echo "=== Building for GOOS=$1 and GOARCH=$2."
|
|
||||||
CGO_ENABLED=0 GOOS="$1" GOARCH="$2" go build -o dist/ \
|
|
||||||
-ldflags="-s -w -X main.gVersion=$version"
|
|
||||||
if test "$?" != "0"; then
|
|
||||||
ERRORS=1
|
|
||||||
else
|
|
||||||
package "$1" "$2" || exit 5
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
package() (
|
|
||||||
cd dist || return 1
|
|
||||||
# Since the function is surrounded by (), the cd only affects a subshell
|
|
||||||
OUTFILE=
|
|
||||||
case "$1" in
|
|
||||||
windows)
|
|
||||||
OUTFILE="lf-$1-$2.zip"
|
|
||||||
zip "$OUTFILE" lf.exe --move || return 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
OUTFILE="lf-$1-$2.tar.gz"
|
|
||||||
tar czf "$OUTFILE" lf --remove-files || return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo "dist/$OUTFILE successfully created."
|
|
||||||
)
|
|
||||||
|
|
||||||
build android arm64
|
|
||||||
build darwin amd64
|
|
||||||
build darwin arm64
|
|
||||||
build dragonfly amd64
|
|
||||||
build freebsd 386
|
|
||||||
build freebsd amd64
|
|
||||||
build freebsd arm
|
|
||||||
build illumos amd64
|
|
||||||
build linux 386
|
|
||||||
build linux amd64
|
|
||||||
build linux arm
|
|
||||||
build linux arm64
|
|
||||||
build linux ppc64
|
|
||||||
build linux ppc64le
|
|
||||||
build linux mips
|
|
||||||
build linux mipsle
|
|
||||||
build linux mips64
|
|
||||||
build linux mips64le
|
|
||||||
build linux s390x
|
|
||||||
build netbsd 386
|
|
||||||
build netbsd amd64
|
|
||||||
build netbsd arm
|
|
||||||
build openbsd 386
|
|
||||||
build openbsd amd64
|
|
||||||
build openbsd arm
|
|
||||||
build openbsd arm64
|
|
||||||
build solaris amd64
|
|
||||||
build windows 386
|
|
||||||
build windows amd64
|
|
||||||
# Unsupported
|
|
||||||
# build aix ppc64
|
|
||||||
# build android 386
|
|
||||||
# build android amd64
|
|
||||||
# build android arm
|
|
||||||
# build js wasm
|
|
||||||
# build plan9 386
|
|
||||||
# build plan9 amd64
|
|
||||||
# build plan9 arm
|
|
||||||
|
|
||||||
if test -n "$ERRORS"; then
|
|
||||||
printf "\ngen/xbuild.sh: some targets failed to compile.\n"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# vim: tabstop=4 shiftwidth=4 textwidth=80 colorcolumn=80
|
|
||||||
Reference in new issue
Block a user