Skip to content

Commit

Permalink
Update go-bouncer to build arm64 binaries for macOS and Linux
Browse files Browse the repository at this point in the history
This also updates the goreleaser install process to use "go install" and
will use version 1.3.1 for goreleaser and updates the Go version used in
the CI to 1.17.6.

Signed-off-by: Dustin Schoenbrun <dustin.schoenbrun@anchore.com>

add more pr events for validations pipeline

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
Signed-off-by: Dustin Schoenbrun <dustin.schoenbrun@anchore.com>
  • Loading branch information
Dustin Schoenbrun committed Jan 20, 2022
1 parent 4d0ec92 commit e48e641
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 25 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ name: 'app-pipeline'
on:
push:
pull_request:
types: [ opened, reopened ]
jobs:
test:
strategy:
matrix:
go-version: [1.14.x]
go-version: [1.17.x]
platform: [ubuntu-latest, macos-latest] # TODO: add 'windows-latest' support
runs-on: ${{ matrix.platform }}
steps:
Expand Down Expand Up @@ -44,7 +43,7 @@ jobs:
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.14.x'
go-version: '1.17.x'

- uses: actions/checkout@v1

Expand Down Expand Up @@ -76,35 +75,52 @@ jobs:
needs: [ build-artifacts ]
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@master

- uses: actions/download-artifact@master
with:
name: artifacts
path: dist

- name: Test linux run
run: make ci-test-linux-run

- name: Test docker run
run: make ci-plugs-out-test

# test-linux-arm-artifacts:
# needs: [ build-artifacts ]
# runs-on: [ubuntu-latest, ARM64]
# steps:
# - uses: actions/checkout@master
# - uses: actions/download-artifact@master
# with:
# name: artifacts
# path: dist
# - name: Test linux run
# run: make ci-test-linux-arm-run

test-mac-artifacts:
needs: [ build-artifacts ]
runs-on: macos-latest
steps:

- uses: actions/checkout@master

- uses: actions/download-artifact@master
with:
name: artifacts
path: dist

- name: Test darwin run
run: make ci-test-mac-run

# test-mac-arm-artifacts:
# needs: [ build-artifacts ]
# runs-on: [macos-latest, ARM64]
# steps:
# - uses: actions/checkout@master
# - uses: actions/download-artifact@master
# with:
# name: artifacts
# path: dist
# - name: Test darwin run
# run: make ci-test-mac-arm-run

release:
needs: [ test, build-artifacts, test-linux-artifacts, test-mac-artifacts ] # TODO: add windows support
runs-on: ubuntu-latest
Expand All @@ -113,7 +129,7 @@ jobs:

- uses: actions/setup-go@v1
with:
go-version: '1.14.x'
go-version: '1.17.x'

- uses: actions/checkout@v1

Expand Down
40 changes: 27 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ bootstrap: ## Download and install all project dependencies (+ prep tooling in t
tar -xzvf pkger_0.17.0_Linux_x86_64.tar.gz pkger && \
mv pkger $(BIN)
# install goreleaser
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- -b $(BIN) v0.138.0
GOBIN=$(BIN) go install github.com/goreleaser/goreleaser@v1.3.1

$(DBASSET):
$(call title,Building assets)
Expand Down Expand Up @@ -100,24 +100,38 @@ ci-plugs-out-test:
-w //src \
golang:latest \
/bin/bash -x -c "\
./dist/go-bouncer_linux_amd64/bouncer version && \
./dist/go-bouncer_linux_amd64/bouncer list github.com/wagoodman/go-bouncer && \
./dist/go-bouncer_linux_amd64/bouncer check github.com/wagoodman/go-bouncer \
./dist/go-bouncer_unix_linux_amd64/bouncer version && \
./dist/go-bouncer_unix_linux_amd64/bouncer list github.com/wagoodman/go-bouncer && \
./dist/go-bouncer_unix_linux_amd64/bouncer check github.com/wagoodman/go-bouncer \
"

ci-test-linux-run:
chmod 755 ./dist/go-bouncer_linux_amd64/bouncer && \
./dist/go-bouncer_linux_amd64/bouncer version && \
./dist/go-bouncer_linux_amd64/bouncer list github.com/wagoodman/go-bouncer
chmod 755 ./dist/go-bouncer_unix_linux_amd64/bouncer && \
./dist/go-bouncer_unix_linux_amd64/bouncer version && \
./dist/go-bouncer_unix_linux_amd64/bouncer list github.com/wagoodman/go-bouncer

ci-test-linux-arm-run:
chmod 755 ./dist/go-bouncer_unix_linux_arm64/bouncer && \
./dist/go-bouncer_unix_linux_arm64/bouncer version && \
./dist/go-bouncer_unix_linux_arm64/bouncer list github.com/wagoodman/go-bouncer

ci-test-mac-run:
chmod 755 ./dist/go-bouncer_darwin_amd64/bouncer && \
./dist/go-bouncer_darwin_amd64/bouncer version && \
./dist/go-bouncer_darwin_amd64/bouncer list github.com/wagoodman/go-bouncer
chmod 755 ./dist/go-bouncer_unix_darwin_amd64/bouncer && \
./dist/go-bouncer_unix_darwin_amd64/bouncer version && \
./dist/go-bouncer_unix_darwin_amd64/bouncer list github.com/wagoodman/go-bouncer

ci-test-mac-arm-run:
chmod 755 ./dist/go-bouncer_unix_darwin_arm64/bouncer && \
./dist/go-bouncer_unix_darwin_arm64/bouncer version && \
./dist/go-bouncer_unix_darwin_arm64/bouncer list github.com/wagoodman/go-bouncer

ci-test-windows-run:
./dist/go-bouncer_windows_amd64/bouncer version && \
./dist/go-bouncer_windows_amd64/bouncer list github.com/wagoodman/go-bouncer
./dist/go-bouncer_windows_windows_amd64/bouncer version && \
./dist/go-bouncer_windows_windows_amd64/bouncer list github.com/wagoodman/go-bouncer

ci-release: pkged.go
$(BIN)/goreleaser --rm-dist
$(BIN)/goreleaser --rm-dist

clean:
rm -rf dist
rm -rf .tmp
1 change: 1 addition & 0 deletions bouncer/licenses/testdata/tags/tags.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build tags
// +build tags

// Copyright 2019 Google Inc. All Rights Reserved.
Expand Down
13 changes: 12 additions & 1 deletion goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@ release:

builds:
- binary: bouncer
id: go-bouncer_unix
env:
- CGO_ENABLED=0
goos:
- windows
- darwin
- linux
goarch:
- amd64
- arm64
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildTime={{.Date}}`.

- binary: bouncer
id: go-bouncer_windows
env:
- CGO_ENABLED=0
goos:
- windows
goarch:
- amd64
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.buildTime={{.Date}}`.
Expand Down
1 change: 1 addition & 0 deletions tools.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build tools
// +build tools

package main
Expand Down

0 comments on commit e48e641

Please sign in to comment.