Skip to content

Commit

Permalink
ci: Update GoRelease for MacOS Build (#391)
Browse files Browse the repository at this point in the history
* ci: Update GoRelease for MacOS Build

* ci: Add MacOS Runner
  • Loading branch information
flemzord committed Dec 21, 2022
1 parent 0edfd18 commit a42e40b
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 59 deletions.
30 changes: 17 additions & 13 deletions .github/workflows/template_goreleaser-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
jobs:
goreleaser:
name: GoReleaser Build
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand All @@ -24,25 +27,26 @@ jobs:
with:
name: control-dist
path: cmd/control/
- name: OSXCross for CGO Support
run: |
mkdir ../../osxcross
git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target
- name: Downgrade libssl
run: |
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
echo 'deb http://security.ubuntu.com/ubuntu bionic-security main' | sudo tee -a /etc/apt/sources.list
sudo apt update && apt-cache policy libssl1.0-dev
sudo apt-get install libssl1.0-dev
- run: sudo apt install gcc-aarch64-linux-gnu gcc-mingw-w64 -y
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Run GoReleaser for Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: build --parallelism 4 --rm-dist --skip-validate --snapshot
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}
- name: Run GoReleaser for MacOS
if: ${{ matrix.os == 'macos-latest' }}
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: build -f .goreleaser-darwin.yml --parallelism 4 --rm-dist --skip-validate --snapshot
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}
- uses: actions/upload-artifact@v2
with:
name: dist
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/template_goreleaser-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ on:
jobs:
goreleaser:
name: GoReleaser Build
runs-on: ubuntu-latest
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
Expand All @@ -31,17 +34,8 @@ jobs:
with:
name: control-dist
path: cmd/control/
- name: OSXCross for CGO Support
run: |
mkdir ../../osxcross
git clone https://github.com/plentico/osxcross-target.git ../../osxcross/target
- name: Downgrade libssl
run: |
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 3B4FE6ACC0B21F32
echo 'deb http://security.ubuntu.com/ubuntu bionic-security main' | sudo tee -a /etc/apt/sources.list
sudo apt update && apt-cache policy libssl1.0-dev
sudo apt-get install libssl1.0-dev
- run: sudo apt install gcc-aarch64-linux-gnu gcc-mingw-w64 -y
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
Expand All @@ -52,15 +46,26 @@ jobs:
registry: ghcr.io
username: "NumaryBot"
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- name: Run GoReleaser
- name: Run GoReleaser for Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
- name: Run GoReleaser for MacOS
if: ${{ matrix.os == 'macos-latest' }}
env:
GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
SEGMENT_WRITE_KEY: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release -f .goreleaser-darwin.yml --rm-dist
- uses: actions/cache@v2
with:
path: |
Expand Down
64 changes: 64 additions & 0 deletions .goreleaser-darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
project_name: numary
env:
- GO111MODULE=on
- GOPROXY=https://proxy.golang.org
before:
hooks:
- go mod download

builds:
- binary: numary
id: numary_darwin
ldflags:
- -X github.com/numary/ledger/cmd.BuildDate={{ .Date }}
- -X github.com/numary/ledger/cmd.Version={{ .Version }}
- -X github.com/numary/ledger/cmd.Commit={{ .ShortCommit }}
- -X github.com/numary/ledger/cmd.DefaultSegmentWriteKey={{ .Env.SEGMENT_WRITE_KEY }}
- -s
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
- arm64
flags:
- -tags=json1

archives:
- id: "numary"
builds:
- numary_darwin
format: tar.gz
format_overrides:
- goos: windows
format: zip
name_template: "{{.ProjectName}}_{{.Version}}_{{.Os}}-{{.Arch}}"
replacements:
amd64: 64bit
386: 32bit
arm: ARM
arm64: ARM64
darwin: macOS
linux: Linux
windows: Windows


checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}"

brews:
- tap:
owner: formancehq
name: homebrew-tap
name: numary
folder: Formula
homepage: https://formance.com
skip_upload: auto
test: |
system "#{bin}/numary version"
install: |
bin.install "numary"
33 changes: 0 additions & 33 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,12 @@ builds:
- arm64
flags:
- -tags=json1,netgo
- binary: numary
id: numary_darwin
ldflags:
- -X github.com/numary/ledger/cmd.BuildDate={{ .Date }}
- -X github.com/numary/ledger/cmd.Version={{ .Version }}
- -X github.com/numary/ledger/cmd.Commit={{ .ShortCommit }}
- -X github.com/numary/ledger/cmd.DefaultSegmentWriteKey={{ .Env.SEGMENT_WRITE_KEY }}
- -s
env:
- CGO_ENABLED=1
- CC=/home/runner/work/osxcross/target/bin/o64-clang
- CXX=/home/runner/work/osxcross/target/bin/o64-clang++
goos:
- darwin
goarch:
- amd64
- arm64
flags:
- -tags=json1

archives:
- id: "numary"
builds:
- numary_linux_amd64
- numary_linux_arm64
- numary_darwin
- numary_windows
format: tar.gz
format_overrides:
Expand Down Expand Up @@ -135,19 +115,6 @@ release:
- Read the [documentation](https://docs.numary.com/oss/ledger/get-started/installation)
- Join our [Discord server](https://discord.gg/xyHvcbzk4w)
brews:
- tap:
owner: formancehq
name: homebrew-tap
name: numary
folder: Formula
homepage: https://formance.com
skip_upload: auto
test: |
system "#{bin}/numary version"
install: |
bin.install "numary"
nfpms:
- id: packages
package_name: numary
Expand Down

0 comments on commit a42e40b

Please sign in to comment.