From 66c3a46e4cfccca1d0fa86e87b2a6607b4ad2c8f Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 10 Dec 2024 19:11:18 +0100 Subject: [PATCH 1/2] GitHub: allow not caching the Golang build cache This is a tradeoff of disk space (and with that cache size) and compilation speed. Because we're still running into disk full errors with the full build cache, we remove it for the cross compile step. Which means we'll do more work each time. --- .github/actions/setup-go/action.yml | 21 ++++++++++++++++++++- .github/workflows/main.yml | 1 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index 522b94dca3..e3e91f0419 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -7,6 +7,12 @@ inputs: key-prefix: description: "A prefix to use for the cache key, to separate cache entries from other workflows" required: false + use-build-cache: + description: "Whether to use the build cache" + required: false + # Boolean values aren't supported in the workflow syntax, so we use a + # string. To not confuse the value with true/false, we use 'yes' and 'no'. + default: 'yes' runs: using: "composite" @@ -17,7 +23,8 @@ runs: with: go-version: '${{ inputs.go-version }}' - - name: go cache + - name: go module and build cache + if: ${{ inputs.use-build-cache == 'yes' }} uses: actions/cache@v3 with: # In order: @@ -35,6 +42,18 @@ runs: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}- ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}- + - name: go module cache + if: ${{ inputs.use-build-cache == 'no' }} + uses: actions/cache@v3 + with: + # Just the module download cache. + path: | + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}- + ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache- + - name: set GOPATH shell: bash run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd8b5dbfe3..290a3b8377 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -148,6 +148,7 @@ jobs: with: go-version: '${{ env.GO_VERSION }}' key-prefix: cross-compile + use-build-cache: 'no' - name: build release for all architectures run: make release From c022284f37691c97c9338dbae1ccb82ae4f6a6df Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 10 Dec 2024 19:12:29 +0100 Subject: [PATCH 2/2] GitHub+make: run cross compile in matrix This is just a test, perhaps this doesn't make any sense at all as it will clog up too many build runners. --- .github/workflows/main.yml | 13 ++++++++++++- make/release_flags.mk | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 290a3b8377..e70c6406a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -139,6 +139,17 @@ jobs: cross-compile: name: cross compilation runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + # Please keep this list in sync with make/release_flags.mk! + include: + - name: i386 + sys: freebsd-386 linux-386 windows-386 + - name: amd64 + sys: darwin-amd64 freebsd-amd64 linux-amd64 netbsd-amd64 openbsd-amd64 windows-amd64 + - name: arm + sys: darwin-arm64 freebsd-arm linux-armv6 linux-armv7 linux-arm64 windows-arm steps: - name: git checkout uses: actions/checkout@v3 @@ -151,7 +162,7 @@ jobs: use-build-cache: 'no' - name: build release for all architectures - run: make release + run: make release sys="${{ matrix.sys }}" ######################## # sample configuration check diff --git a/make/release_flags.mk b/make/release_flags.mk index 92e08c3ba5..8cfe703bd6 100644 --- a/make/release_flags.mk +++ b/make/release_flags.mk @@ -11,6 +11,7 @@ DOCKER_RELEASE_HELPER = docker run \ -e SKIP_VERSION_CHECK \ lnd-release-helper +# Please keep this list in sync with .github/workflows/main.yml! BUILD_SYSTEM = darwin-amd64 \ darwin-arm64 \ freebsd-386 \