feat: enhance dev workflow and prepare for goreleaser

- Update Makefile with new targets:
  - lint-backend: Run golangci-lint via Docker
  - lint-docker: Run hadolint via Docker
  - test-race: Run Go tests with race detection
  - benchmark: Run Go benchmarks
  - integration-test: Run local integration tests
- Update .pre-commit-config.yaml:
  - Add go-test-race hook
  - Add golangci-lint hook
  - Add hadolint hook
- Add .goreleaser.yaml configuration:
  - Define builds for linux/amd64 and linux/arm64
  - Configure archive creation (tar.gz)
  - Configure package creation (deb, rpm)
- Add .github/workflows/release-goreleaser.yml:
  - New workflow to test GoReleaser builds
  - Builds frontend first, then uses GoReleaser
  - Handles cross-compilation dependencies
This commit is contained in:
Wikid82
2025-11-28 00:28:42 +00:00
parent fc27b5c42e
commit ca4ddc4e3e
4 changed files with 161 additions and 0 deletions

67
.goreleaser.yaml Normal file
View File

@@ -0,0 +1,67 @@
version: 2
project_name: cpmp
builds:
- id: cpmp
dir: backend
main: ./cmd/api
binary: cpmp
env:
- CGO_ENABLED=1
goos:
- linux
goarch:
- amd64
- arm64
ldflags:
- -s -w
- -X github.com/Wikid82/CaddyProxyManagerPlus/backend/internal/version.Version={{.Version}}
- -X github.com/Wikid82/CaddyProxyManagerPlus/backend/internal/version.GitCommit={{.Commit}}
- -X github.com/Wikid82/CaddyProxyManagerPlus/backend/internal/version.BuildTime={{.Date}}
archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- .Os }}_
{{- .Arch }}
files:
- LICENSE
- README.md
nfpms:
- id: packages
package_name: cpmp
vendor: CaddyProxyManagerPlus
homepage: https://github.com/Wikid82/CaddyProxyManagerPlus
maintainer: Wikid82
description: "Caddy Proxy Manager Plus - A powerful reverse proxy manager"
license: MIT
formats:
- deb
- rpm
contents:
- src: ./backend/data/
dst: /var/lib/cpmp/data/
type: dir
- src: ./frontend/dist/
dst: /usr/share/cpmp/frontend/
type: dir
dependencies:
- libc6
- ca-certificates
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'