Skip to content

Commit a22e82c

Browse files
AdamShannagAdamShannag
authored andcommitted
feat: volare
Signed-off-by: Adam Shannag <shannagadam11@gmail.com>
0 parents  commit a22e82c

File tree

25 files changed

+2007
-0
lines changed

25 files changed

+2007
-0
lines changed

.github/workflows/build.yml

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Build & Verify Pipeline
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
paths-ignore:
7+
- "**.MD"
8+
- ".gitignore"
9+
pull_request:
10+
paths-ignore:
11+
- "**.MD"
12+
- ".gitignore"
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
id-token: write
18+
security-events: write
19+
pull-requests: read
20+
checks: write
21+
22+
env:
23+
GO_VERSION: "1.24.4"
24+
REGISTRY: ghcr.io
25+
26+
jobs:
27+
# Static analysis and code quality check
28+
verify:
29+
name: Code Quality
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
persist-credentials: false
37+
38+
- name: Set up Go
39+
uses: actions/setup-go@v5
40+
with:
41+
go-version: ${{ env.GO_VERSION }}
42+
cache: true
43+
check-latest: true
44+
45+
- name: Install dependencies
46+
run: |
47+
go mod download
48+
go mod verify
49+
50+
- name: Check Go mod tidy
51+
run: |
52+
go mod tidy
53+
if ! git diff --quiet go.mod go.sum; then
54+
echo "go.mod or go.sum is not tidy, run 'go mod tidy'"
55+
git diff go.mod go.sum
56+
exit 1
57+
fi
58+
59+
- name: Run golangci-lint
60+
uses: golangci/golangci-lint-action@v7
61+
with:
62+
version: v2.0
63+
args: --timeout=5m
64+
only-new-issues: true
65+
install-mode: binary
66+
skip-cache: false
67+
skip-pkg-cache: true
68+
skip-build-cache: true
69+
70+
- name: Check formatting
71+
run: |
72+
if [ -n "$(gofmt -l .)" ]; then
73+
echo "The following files are not formatted properly:"
74+
gofmt -l .
75+
exit 1
76+
fi
77+
78+
# Security vulnerability scanning and SBOM generation
79+
security:
80+
name: Security Scan
81+
runs-on: ubuntu-latest
82+
needs: verify
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v4
86+
with:
87+
persist-credentials: false
88+
89+
- name: Set up Go
90+
uses: actions/setup-go@v5
91+
with:
92+
go-version: ${{ env.GO_VERSION }}
93+
cache: true
94+
95+
- name: Run Go Vulnerability Check
96+
run: |
97+
go install golang.org/x/vuln/cmd/govulncheck@latest
98+
govulncheck ./...
99+
100+
- name: Run dependency scan
101+
uses: aquasecurity/trivy-action@master
102+
with:
103+
scan-type: "fs"
104+
scan-ref: "."
105+
format: "sarif"
106+
output: "trivy-results.sarif"
107+
severity: "CRITICAL,HIGH,MEDIUM"
108+
ignore-unfixed: true
109+
timeout: "10m"
110+
111+
- name: Upload security scan results
112+
uses: github/codeql-action/upload-sarif@v3
113+
if: always()
114+
with:
115+
sarif_file: "trivy-results.sarif"
116+
117+
- name: Generate SBOM
118+
uses: CycloneDX/gh-gomod-generate-sbom@v2
119+
with:
120+
version: v1
121+
args: mod -licenses -json -output bom.json
122+
123+
- name: Upload SBOM
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: sbom
127+
path: bom.json
128+
retention-days: 30
129+
130+
# Run unit and integration tests with code coverage
131+
test:
132+
name: Run Tests
133+
runs-on: ubuntu-latest
134+
needs: verify
135+
steps:
136+
- name: Checkout code
137+
uses: actions/checkout@v4
138+
with:
139+
persist-credentials: false
140+
141+
- name: Set up Go
142+
uses: actions/setup-go@v5
143+
with:
144+
go-version: ${{ env.GO_VERSION }}
145+
cache: true
146+
147+
- name: Run tests
148+
run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
149+
150+
- name: Upload coverage
151+
uses: codecov/codecov-action@v5
152+
with:
153+
file: ./coverage.txt
154+
flags: unittests
155+
fail_ci_if_error: false
156+
157+
# Simple build verification (for PRs and non-main branches)
158+
build:
159+
name: Build Verification
160+
runs-on: ubuntu-latest
161+
needs: [ verify, security ]
162+
# Only run for PRs or pushes to non-main branches
163+
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
164+
steps:
165+
- name: Checkout code
166+
uses: actions/checkout@v4
167+
with:
168+
persist-credentials: false
169+
170+
- name: Set up Go
171+
uses: actions/setup-go@v5
172+
with:
173+
go-version: ${{ env.GO_VERSION }}
174+
cache: true
175+
176+
- name: Build
177+
run: go build -v ./...

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: '1.24.4'
20+
21+
- name: Run GoReleaser
22+
uses: goreleaser/goreleaser-action@v6
23+
with:
24+
distribution: goreleaser
25+
version: ${{ env.GITHUB_REF_NAME }}
26+
args: release --clean
27+
workdir: ./
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Binaries for programs and plugins
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
8+
# Test binary, built with "go test -c"
9+
*.test
10+
11+
# Output of the go coverage tool, specifically when used with LiteIDE
12+
*.out
13+
14+
# Dependency directories (remove the comment below to include it)
15+
# vendor/
16+
17+
# Go workspace file
18+
go.work
19+
tmp/
20+
21+
# IDE specific files
22+
.vscode
23+
.idea
24+
25+
# .env file
26+
.env
27+
28+
# Project build
29+
main
30+
*templ.go
31+
32+
# OS X generated file
33+
.DS_Store
34+
35+
.gen

.goreleaser.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: 2
2+
before:
3+
hooks:
4+
- go mod tidy
5+
6+
env:
7+
- PACKAGE_PATH=github.com/AdamShannag/volare/cmd
8+
9+
builds:
10+
- binary: "{{ .ProjectName }}"
11+
main: ./cmd/volare
12+
goos:
13+
- linux
14+
goarch:
15+
- amd64
16+
- arm64
17+
env:
18+
- CGO_ENABLED=0
19+
ldflags:
20+
- -s -w -X {{.Env.PACKAGE_PATH}}={{.Version}}
21+
release:
22+
prerelease: auto
23+
24+
universal_binaries:
25+
- replace: true
26+
27+
archives:
28+
- name_template: >
29+
{{- .ProjectName }}_{{- .Version }}_{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else if eq .Arch "386" }}i386{{- else }}{{ .Arch }}{{ end }}{{- if .Arm }}v{{ .Arm }}{{ end -}}
30+
format_overrides:
31+
- goos: windows
32+
formats: [ zip ]
33+
builds_info:
34+
group: root
35+
owner: root
36+
files:
37+
- README.MD
38+
39+
checksum:
40+
name_template: 'checksums.txt'

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM golang:1.24-alpine AS build
2+
3+
WORKDIR /app
4+
COPY . .
5+
6+
RUN go mod tidy
7+
RUN go build -o volare cmd/volare/main.go
8+
9+
FROM alpine:3.21.3 AS prod
10+
11+
COPY --from=build /app/volare /usr/local/bin/volare
12+
13+
ENTRYPOINT [ "volare" ]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Adam Shannag
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)