ci: just the beginning

This commit is contained in:
Marvin Preuss 2024-09-19 12:01:49 +02:00
parent 100a726730
commit b97f06a2c6
6 changed files with 76 additions and 0 deletions

12
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: "ci"
on:
pull_request:
push:
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
- run: nix develop . -c golangci-lint run --enable-all
- run: nix develop . -c go test -v -race ./...

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.direnv
result
dist/

44
.goreleaser.yaml Normal file
View File

@ -0,0 +1,44 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
version: 2
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm64
ldflags:
- "-s"
- "-w"
- "-extldflags '-static'"
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
dockers:
- image_templates:
- xsteadfastx/caddy-log-exporter:{{ .Tag }}-amd64
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- image_templates:
- xsteadfastx/caddy-log-exporter:{{ .Tag }}-arm64
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
goarch: arm64

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM scratch
ENTRYPOINT ["/caddy-log-exporter"]
COPY caddy-log-exporter /

View File

@ -6,6 +6,7 @@ tasks:
cmds:
- task: lint
- task: test
- task: release-snapshot
lint:
cmds:
@ -14,3 +15,16 @@ tasks:
test:
cmds:
- "{{.NIX_CMD_BASE}} go test -v -race ./..."
tidy:
cmds:
- go mod tidy
- go mod vendor
release:
cmds:
- "{{.NIX_CMD_BASE}} goreleaser release --clean"
release-snapshot:
cmds:
- "{{.NIX_CMD_BASE}} goreleaser release --clean --snapshot"

View File

@ -22,6 +22,7 @@
golines
gopls
goreleaser
ko
];
in
with pkgs; {