Skip to content

Commit

Permalink
refactor goreleaser-ci jobs to own workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 committed May 24, 2022
1 parent 0bdab28 commit 9ee2bd9
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/goreleaser-cross-compiler-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
archives:
- files:
# Ensure only built binary is archived
- 'none*'
format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
before:
hooks:
- 'go mod download'
builds:
# Check and build binary for 32-bit architecture (FreeBSD/ARM)
- id: 32-bit-arch
# Binary naming only required for Terraform CLI 0.12
binary: '{{ .ProjectName }}_v{{ .Version }}_x5'
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos:
- freebsd
goarch:
- arm
ldflags:
- -s -w -X version.ProviderVersion={{.Version}}
mod_timestamp: '{{ .CommitTimestamp }}'
snapshot:
name_template: "{{ .Tag }}-next"
73 changes: 73 additions & 0 deletions .github/workflows/goreleaser-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Continuous integration handling for GoReleaser
name: GoReleaser CI

on:
push:
branches:
- main
- 'release/**'
pull_request:
paths:
- .github/workflows/goreleaser-ci.yml
- .goreleaser.yml
- .go-version
- go.sum
- main.go
- internal/**
- names/**
- providerlint/**
- skaff/**
- tools/**

jobs:
changes:
runs-on: ubuntu-latest
outputs:
goreleaser: ${{ steps.filter.outputs.goreleaser }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
goreleaser:
- '.github/workflows/goreleaser-ci.yml'
- '.goreleaser.yml'
check:
needs: changes
if: ${{ needs.changes.outputs.goreleaser == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- uses: actions/cache@v2
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- name: goreleaser check
uses: goreleaser/goreleaser-action@v2
with:
args: check
build-32-bit:
# Run a single compiler check for 32-bit architecture (FreeBSD/ARM)
# Ref: https://github.com/hashicorp/terraform-provider-aws/issues/8988
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: go.mod
- uses: actions/cache@v2
continue-on-error: true
timeout-minutes: 2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }}
- name: goreleaser build
uses: goreleaser/goreleaser-action@v2
with:
args: build --config .github/goreleaser-cross-compiler-test.yml --id 32-bit-arch --snapshot

0 comments on commit 9ee2bd9

Please sign in to comment.