try to cache go
Some checks failed
Build Process Supervisor / build (amd64, , linux) (push) Failing after 2m52s
Build Process Supervisor / build (amd64, .exe, windows) (push) Failing after 2m53s
Build Process Supervisor / build (arm, 6, , linux) (push) Failing after 26s
Build Process Supervisor / build (arm64, , linux) (push) Failing after 26s
Some checks failed
Build Process Supervisor / build (amd64, , linux) (push) Failing after 2m52s
Build Process Supervisor / build (amd64, .exe, windows) (push) Failing after 2m53s
Build Process Supervisor / build (arm, 6, , linux) (push) Failing after 26s
Build Process Supervisor / build (arm64, , linux) (push) Failing after 26s
This commit is contained in:
@@ -33,26 +33,56 @@ jobs:
|
|||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Ensure latest Go is installed in /data/go
|
||||||
uses: actions/setup-go@v4
|
run: |
|
||||||
with:
|
export GOROOT=/data/go/go
|
||||||
go-version: '1.24.5'
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
export GOCACHE=/data/gocache
|
||||||
|
export GOMODCACHE=/data/gomodcache
|
||||||
|
mkdir -p $GOCACHE $GOMODCACHE
|
||||||
|
|
||||||
- name: Cache Go modules
|
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)
|
||||||
|
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: Cache Go build and module cache in /data
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cache/go-build
|
/data/gocache
|
||||||
~/go/pkg/mod
|
/data/gomodcache
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-go-
|
${{ runner.os }}-go-
|
||||||
|
|
||||||
- name: Download Go dependencies
|
- name: Download Go dependencies
|
||||||
run: go mod download
|
|
||||||
|
|
||||||
- name: Build binaries
|
|
||||||
run: |
|
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 }}"
|
OUTPUT="bin/${APP_NAME}-${{ matrix.os }}-${{ matrix.arch }}"
|
||||||
if [ -n "${{ matrix.arm_version }}" ]; then
|
if [ -n "${{ matrix.arm_version }}" ]; then
|
||||||
OUTPUT="${OUTPUT}v${{ matrix.arm_version }}"
|
OUTPUT="${OUTPUT}v${{ matrix.arm_version }}"
|
||||||
@@ -63,8 +93,12 @@ jobs:
|
|||||||
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -ldflags="-s -w" -trimpath -o "$OUTPUT"
|
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -ldflags="-s -w" -trimpath -o "$OUTPUT"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Upload artifacts
|
- 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
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.arm_version && format('v{0}', matrix.arm_version) || '' }}${{ matrix.ext }}
|
name: ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
path: bin/${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.arm_version && format('v{0}', matrix.arm_version) || '' }}${{ matrix.ext }}
|
path: bin/${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.zip
|
||||||
|
Reference in New Issue
Block a user