Skip to content

Commit a0b81ec

Browse files
committed
initial
0 parents  commit a0b81ec

23 files changed

Lines changed: 1396 additions & 0 deletions

.dockerignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Git and GitHub
2+
.git
3+
.github
4+
.gitignore
5+
.dockerignore
6+
7+
# Build and CI artifacts
8+
*.test
9+
*.out
10+
*.prof
11+
*.json
12+
*.txt
13+
Makefile
14+
docker-compose.yml
15+
16+
# Documentation
17+
README.md
18+
LICENSE
19+
20+
# Source code that shouldn't be in the runtime image
21+
* _test.go
22+
docs/
23+
24+
# IDE files
25+
.vscode
26+
.idea

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.{yml,yaml}]
12+
indent_size = 2

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
name: Build
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@v3
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to Docker registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: dhi.io
27+
username: ${{ secrets.DHI_USERNAME }}
28+
password: ${{ secrets.DHI_TOKEN }}
29+
30+
- name: Build
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: .
34+
platforms: linux/amd64,linux/arm64
35+
push: false
36+
cache-from: type=gha
37+
cache-to: type=gha,mode=max

.github/workflows/check.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Check
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
check:
12+
name: ${{ matrix.task }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
task: [test, lint]
17+
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v6
23+
with:
24+
go-version: 1.25
25+
26+
- name: Test
27+
if: matrix.task == 'test'
28+
run: go test -v ./...
29+
30+
- name: Lint
31+
if: matrix.task == 'lint'
32+
uses: golangci/golangci-lint-action@v9
33+
with:
34+
version: v2.7

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
check:
14+
name: Check
15+
uses: ./.github/workflows/check.yml
16+
17+
build:
18+
name: Build
19+
needs: check
20+
uses: ./.github/workflows/build.yml
21+
secrets: inherit

.github/workflows/release.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Publish and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
id-token: write
12+
13+
jobs:
14+
check:
15+
name: Check
16+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
17+
uses: ./.github/workflows/check.yml
18+
19+
publish:
20+
name: Publish
21+
needs: check
22+
runs-on: ubuntu-latest
23+
env:
24+
REGISTRY: ghcr.io
25+
IMAGE_NAME: ${{ github.repository }}
26+
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v5
30+
31+
- name: Install Cosign
32+
uses: sigstore/cosign-installer@v3.7.0
33+
34+
- name: Set up QEMU
35+
uses: docker/setup-qemu-action@v3
36+
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
40+
- name: Log in to Docker registry
41+
uses: docker/login-action@v3
42+
with:
43+
registry: dhi.io
44+
username: ${{ secrets.DHI_USERNAME }}
45+
password: ${{ secrets.DHI_TOKEN }}
46+
47+
- name: Log in to GitHub registry
48+
uses: docker/login-action@v3
49+
with:
50+
registry: ${{ env.REGISTRY }}
51+
username: ${{ github.actor }}
52+
password: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Extract Docker metadata
55+
id: meta
56+
uses: docker/metadata-action@v5
57+
with:
58+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
59+
tags: |
60+
type=semver,pattern={{version}}
61+
type=raw,value=latest
62+
63+
- name: Build and push Docker image
64+
id: build-and-push
65+
uses: docker/build-push-action@v6
66+
with:
67+
context: .
68+
platforms: linux/amd64,linux/arm64
69+
push: true
70+
tags: ${{ steps.meta.outputs.tags }}
71+
labels: ${{ steps.meta.outputs.labels }}
72+
annotations: ${{ steps.meta.outputs.annotations }}
73+
cache-from: type=gha
74+
cache-to: type=gha,mode=max
75+
76+
- name: Sign the published Docker image
77+
env:
78+
TAGS: ${{ steps.meta.outputs.tags }}
79+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
80+
run: |
81+
images=""
82+
for tag in ${TAGS}; do
83+
images+="${tag}@${DIGEST} "
84+
done
85+
cosign sign --yes ${images}
86+
87+
release:
88+
name: Release
89+
if: startsWith(github.ref, 'refs/tags/')
90+
needs: publish
91+
runs-on: ubuntu-latest
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v5
95+
96+
- name: Create Release
97+
uses: softprops/action-gh-release@v2
98+
with:
99+
generate_release_notes: true

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Code coverage profiles and other test artifacts
15+
*.out
16+
coverage.*
17+
*.coverprofile
18+
profile.cov
19+
20+
# Dependency directories (remove the comment below to include it)
21+
# vendor/
22+
23+
# Go workspace file
24+
go.work
25+
go.work.sum
26+
27+
# env file
28+
.env
29+
30+
# Editor/IDE
31+
# .idea/
32+
# .vscode/

0 commit comments

Comments
 (0)