
Some checks failed
Build Process Supervisor / build (amd64, , linux) (push) Failing after 16s
Build Process Supervisor / build (amd64, .exe, windows) (push) Failing after 16s
Build Process Supervisor / build (arm64, , linux) (push) Has been cancelled
Build Process Supervisor / build (arm, 6, , linux) (push) Has been cancelled
98 lines
2.8 KiB
YAML
98 lines
2.8 KiB
YAML
name: Build Process Supervisor
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
env:
|
|
APP_NAME: processSupervisor
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: windows
|
|
arch: amd64
|
|
ext: .exe
|
|
- os: linux
|
|
arch: amd64
|
|
ext: ""
|
|
- os: linux
|
|
arch: arm64
|
|
ext: ""
|
|
- os: linux
|
|
arch: arm
|
|
arm_version: 6
|
|
ext: ""
|
|
|
|
steps:
|
|
- name: Install zip
|
|
run: sudo apt -get update && sudo apt-get install -y zip
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Ensure latest Go is installed in /data/go
|
|
run: |
|
|
export GOROOT=/data/go/go
|
|
export PATH=$GOROOT/bin:$PATH
|
|
export GOCACHE=/data/gocache
|
|
export GOMODCACHE=/data/gomodcache
|
|
mkdir -p $GOCACHE $GOMODCACHE
|
|
|
|
if [ ! -x "$GOROOT/bin/go" ]; then
|
|
echo "Go not found in $GOROOT, downloading latest stable..."
|
|
|
|
GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | head -n1)
|
|
echo "Latest version is $GO_VERSION"
|
|
|
|
mkdir -p /data/go
|
|
curl -sSL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tar.gz
|
|
tar -C /data/go -xzf /tmp/go.tar.gz
|
|
else
|
|
echo "Using cached Go from $GOROOT"
|
|
fi
|
|
|
|
go version
|
|
|
|
- name: Download Go dependencies
|
|
run: |
|
|
export GOROOT=/data/go/go
|
|
export PATH=$GOROOT/bin:$PATH
|
|
export GOCACHE=/data/gocache
|
|
export GOMODCACHE=/data/gomodcache
|
|
mkdir -p $GOCACHE $GOMODCACHE
|
|
go mod download
|
|
|
|
- name: Build binary
|
|
run: |
|
|
export GOROOT=/data/go/go
|
|
export PATH=$GOROOT/bin:$PATH
|
|
export GOCACHE=/data/gocache
|
|
export GOMODCACHE=/data/gomodcache
|
|
mkdir -p $GOCACHE $GOMODCACHE
|
|
|
|
OUTPUT="bin/${APP_NAME}-${{ matrix.os }}-${{ matrix.arch }}"
|
|
if [ -n "${{ matrix.arm_version }}" ]; then
|
|
OUTPUT="${OUTPUT}v${{ matrix.arm_version }}"
|
|
export GOARM=${{ matrix.arm_version }}
|
|
fi
|
|
OUTPUT="${OUTPUT}${{ matrix.ext }}"
|
|
echo "Building $OUTPUT"
|
|
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -ldflags="-s -w" -trimpath -o "$OUTPUT"
|
|
shell: bash
|
|
|
|
- name: Zip artifact
|
|
run: |
|
|
zip bin/${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.zip bin/${{ env.APP_NAME }}-*
|
|
|
|
- name: Upload zipped artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
|
|
path: bin/${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.zip
|