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

Upgrade to go1.22 and add goreleaser job checker #170

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
39 changes: 39 additions & 0 deletions .github/workflows/check-goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2024 Chainguard, Inc.
# SPDX-License-Identifier: Apache-2.0

name: check-goreleaser

on:
pull_request:

permissions: {}

jobs:
check-goreleaser:
runs-on: ubuntu-latest

container:
image: ghcr.io/gythialy/golang-cross:v1.22.2-0@sha256:642fda874607057c34dfbb2d7fce93dfa37bdb9dbc0cc74835d9c3157a7a0e89

steps:
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3

# - name: install libyara-dev
# run: |
# sudo add-apt-repository -n -y "deb http://archive.ubuntu.com/ubuntu/ mantic main restricted universe multiverse"
# sudo add-apt-repository -n -y "deb http://archive.ubuntu.com/ubuntu/ mantic-updates main restricted universe multiverse"
# sudo add-apt-repository -n -y "deb http://archive.ubuntu.com/ubuntu/ mantic-backports main restricted universe multiverse"
# sudo add-apt-repository -n -y "deb http://security.ubuntu.com/ubuntu mantic-security main restricted universe multiverse"

# sudo apt update && sudo apt install libyara-dev -y

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
distribution: goreleaser
version: latest
args: release --clean --skip=sign --snapshot

- name: check binaries
run: |
./dist/bincapz_linux_amd64_v1/bincapz -h
2 changes: 1 addition & 1 deletion .github/workflows/go-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
go-version: '1.22'
check-latest: true

- name: Checkout code
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

permissions:
contents: write
id-token: write

jobs:
goreleaser:
Expand All @@ -16,10 +17,15 @@ jobs:
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
with:
fetch-depth: 0

- uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0

- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: go.mod
go-version: '1.22'
check-latest: true

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
go-version: '1.22'
check-latest: true

- uses: chainguard-dev/actions/gofmt@main
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
go-version: '1.22'
check-latest: true

- uses: chainguard-dev/actions/goimports@main
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
go-version: '1.22'
check-latest: true

- name: install libyara-dev
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21'
go-version: '1.22'
check-latest: true

- uses: reviewdog/action-misspell@5bd7be2fc7ae56a517184f5c4bbcf2fd7afe3927 # v1.17.0
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ out/

# macOS
*.DS_Store
dist/
52 changes: 44 additions & 8 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,54 @@ before:
- go mod tidy

builds:
- id: bincapz-build
binary: bincapz
# - id: bincapz
# binary: bincapz
# main: ./
# goos:
# - darwin
# # - linux
# # - windows
# goarch:
# # - amd64
# - arm64
# # - arm
# flags:
# - -trimpath
# mod_timestamp: '{{ .CommitTimestamp }}'
# ldflags:
# - -X main.BuildVersion={{.Version}}
# env:
# - CGO_ENABLED=1

- id: darwin-amd64
binary: bincapz-darwin-amd64
no_unique_dist_dir: true
env:
- CC=o64-clang
- CXX=o64-clang++
- CGO_ENABLED=1
main: ./
goos:
- darwin
- linux
- windows
flags:
- -trimpath
mod_timestamp: '{{ .CommitTimestamp }}'
ldflags:
- -X main.BuildVersion={{.Version}}
goos:
- darwin
goarch:
- amd64

signs:
- id: bincapz
signature: "${artifact}.sig"
certificate: "${artifact}.pem"
cmd: cosign
args: ["sign-blob", "--output-signature", "${artifact}.sig", "--output-certificate", "${artifact}.pem", "${artifact}"]
artifacts: binary
- id: checksum
signature: "${artifact}.sig"
certificate: "${artifact}.pem"
cmd: cosign
args: ["sign-blob", "--output-signature", "${artifact}.sig", "--output-certificate", "${artifact}.pem", "${artifact}"]
artifacts: checksum

checksum:
name_template: 'checksums.txt'
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module github.com/chainguard-dev/bincapz

go 1.21.6
go 1.22

require (
github.com/agext/levenshtein v1.2.3
github.com/chainguard-dev/clog v1.3.1
github.com/fatih/color v1.16.0
github.com/google/go-cmp v0.6.0
github.com/google/go-containerregistry v0.19.1
github.com/hillu/go-yara/v4 v4.3.2
Expand All @@ -21,7 +22,6 @@ require (
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/docker v24.0.9+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/kr/pretty v0.2.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down
Loading