Skip to content

Commit

Permalink
[chore] split goreleaser by GOARCH (open-telemetry#344)
Browse files Browse the repository at this point in the history
* [chore] split goreleaser by GOARCH

This is to address a space limit we've run into w/ caching. Additionally, I changed the workflow to
use upload/download artifact to avoid having to create many copies of the cache action for each
combination of GOOS+GOARCH.

Linked issue: open-telemetry#341

Signed-off-by: Alex Boten <[email protected]>

* remove partial config for now

Signed-off-by: Alex Boten <[email protected]>

* exclude unsupported combinations

Signed-off-by: Alex Boten <[email protected]>

---------

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
Alex Boten authored May 29, 2023
1 parent 3971091 commit 7c0183f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci-goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
strategy:
matrix:
GOOS: [linux, windows, darwin]
GOARCH: ["386", amd64, arm64, ppc64le]
exclude:
- GOOS: darwin
GOARCH: "386"
- GOOS: windows
GOARCH: arm64
runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -53,4 +59,5 @@ jobs:
args: --snapshot --clean --skip-sign --skip-sbom --timeout 2h --split
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
36 changes: 15 additions & 21 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ jobs:
strategy:
matrix:
GOOS: [linux, windows, darwin]
GOARCH: ["386", amd64, arm64, ppc64le]
exclude:
- GOOS: darwin
GOARCH: "386"
- GOOS: windows
GOARCH: arm64
runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -49,12 +55,6 @@ jobs:
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- id: cache
uses: actions/cache@v3
with:
path: dist/${{ matrix.GOOS }}
key: ${{ matrix.GOOS }}-${{ env.sha_short }}

- uses: goreleaser/goreleaser-action@v4
if: steps.cache.outputs.cache-hit != 'true' # do not run if cache hit
with:
Expand All @@ -63,10 +63,16 @@ jobs:
args: release --clean --split --timeout 2h
env:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
COSIGN_EXPERIMENTAL: true
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

- uses: actions/upload-artifact@v3
with:
name: all-artifacts
path: dist/*/*

release:
name: Release
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -97,22 +103,10 @@ jobs:
go-version: '~1.20.4'
check-latest: true

# copy the caches from prepare
- shell: bash
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: dist/linux
key: linux-${{ env.sha_short }}
- uses: actions/cache@v3
with:
path: dist/darwin
key: darwin-${{ env.sha_short }}
- uses: actions/cache@v3
- uses: actions/download-artifact@v3
with:
path: dist/windows
key: windows-${{ env.sha_short }}
name: all-artifacts
path: dist

- name: Log into Docker.io
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
Expand Down

0 comments on commit 7c0183f

Please sign in to comment.