Skip to content

Commit

Permalink
CI: Start building binaries for the ARM architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jan 13, 2024
1 parent 184ff93 commit b321386
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
- name: Acquire sources
uses: actions/checkout@v4

- name: Run release job
- name: Run build job
run: ./devtools/release.sh
73 changes: 38 additions & 35 deletions devtools/release_build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/bash
#
# Build release archives for Linux, Darwin and Windows.
# Build release archives for Linux, Darwin, and Windows.
#

# Compute package base name
# Compute package names.
if [[ -z "${NAME}" ]]; then
echo "ERROR: Unable to determine package name"
exit 1
Expand All @@ -24,36 +24,39 @@ fi
BASE_FILENAME="${NAME}-${SUFFIX}"


# Build program for multiple platforms

export GOOS=linux
export GOARCH=386
FILENAME="${BASE_FILENAME}.${GOOS}.${GOARCH}.tar.gz"
echo "Building ${FILENAME}"
go build
tar -cvzf ${FILENAME} ${NAME}
rm ${NAME}

export GOOS=linux
export GOARCH=amd64
FILENAME="${BASE_FILENAME}.${GOOS}.${GOARCH}.tar.gz"
echo "Building ${FILENAME}"
go build
tar -cvzf ${FILENAME} ${NAME}
rm ${NAME}

export GOOS=darwin
export GOARCH=amd64
FILENAME="${BASE_FILENAME}.${GOOS}.${GOARCH}.tar.gz"
echo "Building ${FILENAME}"
go build
tar -cvzf ${FILENAME} ${NAME}
rm ${NAME}

export GOOS=windows
export GOARCH=amd64
FILENAME="${BASE_FILENAME}.${GOOS}.${GOARCH}.zip"
echo "Building ${FILENAME}"
go build -o ${NAME}.exe
zip ${FILENAME} ${NAME}.exe
rm ${NAME}.exe
# Utility functions.

function build_tarball() {
os=$1
arch=$2
filename="${BASE_FILENAME}.${os}.${arch}.tar.gz"
echo "Building ${filename}"
go build
tar -cvzf ${filename} ${NAME}
rm ${NAME}
}

function build_windows_zipball() {
os=$1
arch=$2
filename="${BASE_FILENAME}.${os}.${arch}.zip"
echo "Building ${filename}"
go build -o ${NAME}.exe
zip ${filename} ${NAME}.exe
rm ${NAME}.exe
}


# Build program for multiple platforms.
function main() {
build_tarball linux amd64
build_tarball linux arm64
build_tarball linux 386
build_tarball linux arm
build_tarball darwin amd64
build_tarball darwin arm64
build_windows_zipball windows amd64
build_windows_zipball windows arm64
}

main

0 comments on commit b321386

Please sign in to comment.