From 320940f047e7df2bbd6b4f53a9ecca76c03c094f Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Tue, 27 Jun 2023 15:14:56 +1000 Subject: [PATCH 1/3] release: use osxcross for better cross compiling support Updates the release process to perform better cross compiling support and ultimately, set `CGO_ENABLED=1` in the releases. This does drop Windows and FreeBSD support however, I don't have a great testing story for them at the moment so we can revisit when/if the request arises. --- .github/workflows/release.yml | 4 ++++ .goreleaser.yml | 33 +++++++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f7bfab..8fbeece 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,10 @@ jobs: uses: actions/setup-go@v3 with: go-version: "1.20" + - name: OSXCross for CGO Support + run: | + mkdir ../../osxcross + git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 with: diff --git a/.goreleaser.yml b/.goreleaser.yml index 6a34f5e..c9111c3 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,7 +1,5 @@ builds: - - env: - - CGO_ENABLED=0 - mod_timestamp: '{{ .CommitTimestamp }}' + - id: linux-build flags: - -trimpath asmflags: @@ -10,16 +8,39 @@ builds: - all=-trimpath=$GOPATH ldflags: - -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }} + env: + - CGO_ENABLED=1 goos: - - darwin - - freebsd - linux - - windows + ignore: + - goos: linux + goarch: "386" + - id: darwin-build + flags: + - -trimpath + asmflags: + - all=-trimpath=$GOPATH + gcflags: + - all=-trimpath=$GOPATH + ldflags: + - -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }} + env: + - CGO_ENABLED=1 + - CC=/home/runner/work/osxcross/target/bin/o64-clang + - CXX=/home/runner/work/osxcross/target/bin/o64-clang++ + goos: + - darwin + ignore: + - goos: darwin + goarch: "386" + archives: - format: zip name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}' + checksum: name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' algorithm: sha256 + changelog: skip: true From bd7ea0f143587d4ebcc0e28881af7ec2e44a85fa Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Tue, 27 Jun 2023 15:29:08 +1000 Subject: [PATCH 2/3] clean up cask bumper --- .github/workflows/bump-cask.yaml | 17 +++++++---------- .github/workflows/release.yml | 18 ++++++++---------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/bump-cask.yaml b/.github/workflows/bump-cask.yaml index 9a29efe..4c93d93 100644 --- a/.github/workflows/bump-cask.yaml +++ b/.github/workflows/bump-cask.yaml @@ -21,14 +21,11 @@ jobs: uses: actions/setup-go@v4 with: go-version: "1.20" - - uses: mislav/bump-homebrew-formula-action@v2 + - name: Bump Homebrew tap + uses: macauley/action-homebrew-bump-cask@v1 with: - formula-name: cf-vault - formula-path: Casks/cf-vault.rb - homebrew-tap: jacobbednarz/homebrew-tap - base-branch: master - download-url: https://github.com/jacobbednarz/cf-vault/releases/download/${{ github.event.inputs.tag-name }}/cf-vault_${{ github.event.inputs.tag-name }}_darwin_amd64.zip - commit-message: Bump {{formulaName}} to {{version}} - tag-name: ${{ github.event.inputs.tag-name }} - env: - COMMITTER_TOKEN: ${{ secrets.HOMEBREW_UPDATER_PAT }} + token: ${{ secrets.HOMEBREW_UPDATER_PAT }} + tap: jacobbednarz/homebrew-tap + cask: cf-vault + livecheck: true + dryrun: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8fbeece..a0898b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,16 +28,14 @@ jobs: uses: goreleaser/goreleaser-action@v4 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: mislav/bump-homebrew-formula-action@v2 + - name: Bump Homebrew tap + uses: macauley/action-homebrew-bump-cask@v1 with: - formula-name: cf-vault - formula-path: Casks/cf-vault.rb - homebrew-tap: jacobbednarz/homebrew-tap - base-branch: master - download-url: https://github.com/jacobbednarz/cf-vault/releases/download/${{ steps.extract-version.outputs.tag-name }}/cf-vault_${{ steps.extract-version.outputs.tag-name }}_darwin_amd64.zip - commit-message: Bump {{formulaName}} to {{version}} - env: - COMMITTER_TOKEN: ${{ secrets.HOMEBREW_UPDATER_PAT }} + token: ${{ secrets.HOMEBREW_UPDATER_PAT }} + tap: jacobbednarz/homebrew-tap + cask: cf-vault + livecheck: true + dryrun: false From dcdf2d12781689e1dc6a3a5f024d071947e556c4 Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Tue, 27 Jun 2023 15:29:40 +1000 Subject: [PATCH 3/3] just try mac cross compile builds for now --- .goreleaser.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index c9111c3..a9e5b09 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,20 +1,20 @@ builds: - - id: linux-build - flags: - - -trimpath - asmflags: - - all=-trimpath=$GOPATH - gcflags: - - all=-trimpath=$GOPATH - ldflags: - - -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }} - env: - - CGO_ENABLED=1 - goos: - - linux - ignore: - - goos: linux - goarch: "386" + # - id: linux-build + # flags: + # - -trimpath + # asmflags: + # - all=-trimpath=$GOPATH + # gcflags: + # - all=-trimpath=$GOPATH + # ldflags: + # - -s -w -X github.com/jacobbednarz/cf-vault/cmd.Rev={{ .Version }} + # env: + # - CGO_ENABLED=1 + # goos: + # - linux + # ignore: + # - goos: linux + # goarch: "386" - id: darwin-build flags: - -trimpath