Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use native OS build workers #962

Merged
merged 4 commits into from
Mar 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ jobs:

release-build:
name: release-build
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:

- name: Set up Go 1.x
Expand All @@ -62,10 +67,11 @@ jobs:
uses: actions/checkout@v2

- name: Install dependency required for linux builds
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libudev-dev

- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: build --snapshot --rm-dist
args: build --snapshot --rm-dist --config .goreleaser.${{ matrix.os }}.yml
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ on:
jobs:
release:
name: release
runs-on: macos-latest
strategy:
# the goreleaser and the Github release API doesn't handle concurrent
# access well, so run goreleaser serially
max-parallel: 1
matrix:
os:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:

- name: Set up Go 1.x
Expand All @@ -20,12 +28,13 @@ jobs:
uses: actions/checkout@v2

- name: Install dependency required for linux builds
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libudev-dev

- name: GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
args: release --rm-dist --config .goreleaser.${{ matrix.os }}.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 32 additions & 0 deletions .goreleaser.macos-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
project_name: saml2aws

builds:
- main: ./cmd/saml2aws/main.go
binary: saml2aws
flags:
- -trimpath
- -v
ldflags:
- -s -w -X main.Version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
goos:
- darwin
goarch:
- amd64
- arm64
- arm
overrides:
- goos: linux
goarch: amd64
goamd64: v1
tags:
- hidraw
env:
- CGO_ENABLED=1
archives:
- format: tar.gz
wrap_in_directory: false
# remove README and LICENSE
files:
- LICENSE.md
- README.md
1 change: 0 additions & 1 deletion .goreleaser.yml → .goreleaser.ubuntu-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ builds:
- -s -w -X main.Version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
goos:
- windows
- darwin
- linux
goarch:
- amd64
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
NAME=saml2aws
ARCH=$(shell uname -m)
OS=$(shell uname)
VERSION=2.28.0
ITERATION := 1

Expand Down Expand Up @@ -36,7 +37,13 @@ install:
.PHONY: mod

build: $(BIN_DIR)/goreleaser
$(BIN_DIR)/goreleaser build --snapshot --rm-dist
ifeq ($(OS),Darwin)
$(BIN_DIR)/goreleaser build --snapshot --rm-dist --config $(CURDIR)/.goreleaser.macos-latest.yml
else ifeq ($(OS),Linux)
$(BIN_DIR)/goreleaser build --snapshot --rm-dist --config $(CURDIR)/.goreleaser.ubuntu-latest.yml
else
$(error Unsupported build OS: $(OS))
endif
.PHONY: build

clean:
Expand Down