Skip to content

Commit 1d06d9b

Browse files
committed
init
Signed-off-by: Rez Moss <hi@rezmoss.com>
1 parent 57643a8 commit 1d06d9b

25 files changed

Lines changed: 4068 additions & 1 deletion

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: "1.22"
21+
22+
- name: Download dependencies
23+
run: go mod download
24+
25+
- name: Run tests
26+
run: go test -v -race -coverprofile=coverage.out ./...
27+
28+
- name: Upload coverage
29+
uses: codecov/codecov-action@v4
30+
with:
31+
file: ./coverage.out
32+
fail_ci_if_error: false
33+
34+
lint:
35+
name: Lint
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Set up Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: "1.22"
45+
46+
- name: Run golangci-lint
47+
uses: golangci/golangci-lint-action@v4
48+
with:
49+
version: latest
50+
51+
build:
52+
name: Build
53+
runs-on: ubuntu-latest
54+
needs: [test, lint]
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v4
58+
59+
- name: Set up Go
60+
uses: actions/setup-go@v5
61+
with:
62+
go-version: "1.22"
63+
64+
- name: Verify build
65+
run: go build -v ./...

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
test:
13+
name: Test before release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: "1.22"
25+
26+
- name: Run tests
27+
run: go test -v -race ./...
28+
29+
release:
30+
name: Release
31+
runs-on: ubuntu-latest
32+
needs: test
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Set up Go
40+
uses: actions/setup-go@v5
41+
with:
42+
go-version: "1.22"
43+
44+
- name: Vendor dependencies
45+
run: go mod vendor
46+
47+
- name: Run GoReleaser
48+
uses: goreleaser/goreleaser-action@v5
49+
with:
50+
distribution: goreleaser
51+
version: latest
52+
args: release --clean
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
# HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

.goreleaser.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
version: 2
3+
4+
env:
5+
- CGO_ENABLED=0
6+
7+
before:
8+
hooks:
9+
- go mod tidy
10+
- go mod vendor
11+
12+
builds:
13+
- id: binary
14+
goos:
15+
- windows
16+
- darwin
17+
- linux
18+
goarch:
19+
- amd64
20+
- arm
21+
- arm64
22+
- "386"
23+
goarm:
24+
- "6"
25+
- "7"
26+
ignore:
27+
- goos: windows
28+
goarch: arm
29+
- goos: windows
30+
goarch: arm64
31+
ldflags:
32+
- -s -w
33+
- -X main.version={{.Version}}
34+
- -X main.commit={{.Commit}}
35+
- -X main.date={{.Date}}
36+
- -X main.buildSource=binaryRelease
37+
38+
- id: snap
39+
goos:
40+
- linux
41+
goarch:
42+
- amd64
43+
- arm
44+
- arm64
45+
- "386"
46+
ldflags:
47+
- -s -w
48+
- -X main.version={{.Version}}
49+
- -X main.commit={{.Commit}}
50+
- -X main.date={{.Date}}
51+
- -X main.buildSource=snap
52+
53+
archives:
54+
- id: default
55+
builds:
56+
- binary
57+
name_template: >-
58+
{{ .ProjectName }}_
59+
{{- .Version }}_
60+
{{- title .Os }}_
61+
{{- if eq .Arch "amd64" }}x86_64
62+
{{- else if eq .Arch "386" }}i386
63+
{{- else }}{{ .Arch }}{{ end }}
64+
format_overrides:
65+
- goos: windows
66+
format: zip
67+
68+
checksum:
69+
name_template: "checksums.txt"
70+
71+
snapshot:
72+
version_template: "{{ .Tag }}-next"
73+
74+
changelog:
75+
sort: asc
76+
filters:
77+
exclude:
78+
- "^docs:"
79+
- "^test:"
80+
- "^bump"
81+
- "^chore:"
82+
- Merge pull request
83+
- Merge branch
84+
85+
release:
86+
github:
87+
owner: rezmoss
88+
name: sbomlyze
89+
draft: false
90+
prerelease: auto
91+
name_template: "{{.ProjectName}} v{{.Version}}"
92+
93+
# brews:
94+
# - repository:
95+
# owner: rezmoss
96+
# name: homebrew-sbomlyze
97+
# token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
98+
99+
# directory: Formula
100+
# homepage: "https://github.com/rezmoss/sbomlyze"
101+
# description: "A fast, reliable SBOM diff and analysis tool"
102+
# license: "MIT"
103+
104+
# test: |
105+
# system "#{bin}/sbomlyze", "--help"
106+
107+
# install: |
108+
# bin.install "sbomlyze"
109+
110+
# Optional: Docker images
111+
# dockers:
112+
# - image_templates:
113+
# - "ghcr.io/rezmoss/sbomlyze:{{ .Version }}"
114+
# - "ghcr.io/rezmoss/sbomlyze:latest"
115+
# dockerfile: Dockerfile
116+
# build_flag_templates:
117+
# - "--label=org.opencontainers.image.title={{ .ProjectName }}"
118+
# - "--label=org.opencontainers.image.version={{ .Version }}"

0 commit comments

Comments
 (0)