Skip to content

Commit 138f82a

Browse files
committed
chore: much maintenance
- Refactor github actions into separate test and release workflows - add zizmor workflow - added renovate config + linter - Aggressive linting fixes from an almost-all-on golangci-lint config - Update dependencies
1 parent 3da05ed commit 138f82a

File tree

14 files changed

+403
-215
lines changed

14 files changed

+403
-215
lines changed

.github/workflows/ci.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- opened
10+
- reopened
11+
- synchronize
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
if: github.event_name == 'push' && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]')
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
20+
with:
21+
persist-credentials: false
22+
23+
- name: Run golangci-lint
24+
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6
25+
26+
test:
27+
strategy:
28+
matrix:
29+
go-version: [1.21.x, 1.22.x, 1.23.x, latest]
30+
os: [ubuntu-latest, macos-latest, windows-latest]
31+
runs-on: ${{ matrix.os }}
32+
if: github.event_name == 'push' && !contains(toJson(github.event.commits), '[ci skip]') && !contains(toJson(github.event.commits), '[skip ci]')
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
36+
with:
37+
persist-credentials: false
38+
39+
- name: Set up Go
40+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
41+
with:
42+
go-version: ${{ matrix.go-version }}
43+
44+
- name: Run Unit Tests
45+
run: make test
46+
shell: bash
47+
48+
goreleaser-check:
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
53+
with:
54+
persist-credentials: false
55+
56+
- name: Check goreleaser's Configuration
57+
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6
58+
with:
59+
version: latest
60+
args: check

.github/workflows/main.yaml

Lines changed: 0 additions & 103 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- go.mod
9+
- go.sum
10+
- '**.go'
11+
workflow_dispatch:
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
contents: write
19+
packages: write
20+
21+
steps:
22+
- name: login to ghcr.io
23+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Checkout
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
31+
with:
32+
fetch-depth: 0
33+
persist-credentials: false
34+
35+
- name: Set up Go
36+
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5
37+
with:
38+
cache: false
39+
40+
- name: Run Unit Tests
41+
run: |
42+
make test
43+
44+
# setup qemu and buildx for cross-builds (arm64)
45+
- name: Set up QEMU (for arm64 builds)
46+
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3
47+
48+
- name: Set up Docker Buildx
49+
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
50+
with:
51+
cache-binary: false
52+
53+
- name: Install GoReleaser
54+
uses: goreleaser/goreleaser-action@v2
55+
with:
56+
install-only: true
57+
58+
- name: run autotag to increment version
59+
run: |
60+
curl -sL https://git.io/autotag-install | sudo sh -s -- -b /usr/local/bin
61+
autotag
62+
63+
- name: build and push release artifacts
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.BREW_GITHUB_TOKEN }}
66+
run: |
67+
make deps
68+
make release
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: validate renovate.json5
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
LOG_LEVEL: debug
8+
9+
jobs:
10+
renovate-config-validator:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
13+
14+
steps:
15+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
16+
with:
17+
persist-credentials: false
18+
19+
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
20+
with:
21+
node-version: 20
22+
23+
- run: npx -p renovate renovate-config-validator renovate.json5

.github/workflows/zizmor.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: GitHub Actions Security Analysis with zizmor
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["**"]
8+
9+
jobs:
10+
zizmor:
11+
name: zizmor latest via PyPI
12+
runs-on: ubuntu-latest
13+
permissions:
14+
security-events: write
15+
# required for workflows in private repositories
16+
contents: read
17+
actions: read
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
21+
with:
22+
persist-credentials: false
23+
24+
- name: Install the latest version of uv
25+
uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a # v5
26+
27+
- name: Run zizmor 🌈
28+
run: uvx zizmor --format sarif . > results.sarif
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Upload SARIF file
33+
uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3
34+
with:
35+
sarif_file: results.sarif
36+
category: zizmor

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cov:
1616
@go tool cover -html=cover.out
1717

1818
build:
19-
@go build ./cmd/certin
19+
@CGO_ENABLED=0 go build -v -trimpath ./cmd/certin
2020

2121
release:
2222
@goreleaser $(GORELEASER_ARGS)

0 commit comments

Comments
 (0)