fix(ci): re-build binaries for Go tools #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
checks: write | |
contents: read | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: "0" | |
fetch-tags: "true" | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
cache-dependency-path: go.sum | |
cache: true | |
check-latest: true | |
- name: Install Go tools | |
run: | | |
go clean -modcache | |
which garble && rm -f $(which garble) | |
go install -a gotest.tools/gotestsum@latest | |
go install -a mvdan.cc/garble@latest | |
- name: Init go | |
run: | | |
go mod download | |
go generate . | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
env: | |
GOPROXY: direct | |
- id: govulncheck | |
uses: golang/govulncheck-action@v1 | |
with: | |
go-version-file: go.mod | |
go-package: ./... | |
- name: Test | |
run: | | |
gotestsum --format pkgname -- -race -shuffle=on -covermode=atomic ./... | |
# Do not run release on windows | |
- uses: ruby/setup-ruby@v1 | |
if: ${{ !contains(matrix.os, 'windows') }} | |
with: | |
ruby-version: "3.3" | |
bundler-cache: true | |
- run: gem install asciidoctor | |
if: ${{ !contains(matrix.os, 'windows') }} | |
- name: Setup Syft | |
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin | |
if: ${{ !contains(matrix.os, 'windows') }} | |
- name: Prepare GPG setup | |
run: | | |
mkdir -p $GITHUB_WORKSPACE/.gnupg | |
echo "${{ secrets.GPG_SIGNING_KEY }}" | base64 -d > $GITHUB_WORKSPACE/.gnupg/gpg.key | |
if: ${{ !contains(matrix.os, 'windows') }} | |
- name: Snapshot release | |
uses: goreleaser/goreleaser-action@v6 | |
if: ${{ !contains(matrix.os, 'windows') }} | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean --snapshot | |
env: | |
NFPM_GIT_AGE_PASSPHRASE: ${{ secrets.NFPM_GIT_AGE_PASSPHRASE }} |