Skip to content

Commit 263af0e

Browse files
authored
Merge pull request #2 from EchoTools/feat/ci-cd
feat: Add comprehensive test suite documentation and task breakdown
2 parents d2cb0b3 + 9681bb0 commit 263af0e

58 files changed

Lines changed: 10255 additions & 167 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Git
2+
.git
3+
.gitignore
4+
.gitattributes
5+
6+
# Documentation
7+
*.md
8+
LICENSE
9+
10+
# Docker
11+
Dockerfile
12+
docker-compose.yml
13+
.dockerignore
14+
15+
# CI/CD
16+
.github
17+
18+
# Development
19+
.vscode
20+
.idea
21+
.editorconfig
22+
23+
# Temporary files
24+
*.tmp
25+
*.log
26+
tmp/
27+
28+
# Build artifacts
29+
*.exe
30+
*.exe~
31+
*.dll
32+
*.so
33+
*.dylib
34+
*.test
35+
36+
# Environment
37+
.env
38+
.env.*
39+
!.env.example
40+
41+
# Test coverage
42+
*.out
43+
coverage.*
44+
*.coverprofile

.editorconfig

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Unix-style newlines with a newline ending every file
7+
[*]
8+
end_of_line = lf
9+
insert_final_newline = true
10+
charset = utf-8
11+
trim_trailing_whitespace = true
12+
13+
# Go files
14+
[*.go]
15+
indent_style = tab
16+
indent_size = 4
17+
18+
# YAML files
19+
[*.{yml,yaml}]
20+
indent_style = space
21+
indent_size = 2
22+
23+
# Markdown files
24+
[*.md]
25+
trim_trailing_whitespace = false
26+
indent_style = space
27+
indent_size = 2
28+
29+
# JSON files
30+
[*.json]
31+
indent_style = space
32+
indent_size = 2
33+
34+
# Dockerfile
35+
[Dockerfile*]
36+
indent_style = space
37+
indent_size = 2
38+
39+
# Shell scripts
40+
[*.sh]
41+
indent_style = space
42+
indent_size = 2
43+
44+
# Makefile
45+
[Makefile]
46+
indent_style = tab

.env.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Application Configuration
2+
APP_NAME=golang-daemon-app
3+
APP_PORT=8080
4+
5+
# Logger Configuration
6+
LOG_LEVEL=info
7+
LOG_FORMAT=json
8+
LOG_OUTPUT=stdout

.github/workflows/build.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build and Push Container
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches:
11+
- main
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
id-token: write
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version: '1.25'
35+
36+
- name: Run tests
37+
run: go test -v -race -coverprofile=coverage.out ./...
38+
39+
- name: Upload coverage
40+
uses: codecov/codecov-action@v4
41+
with:
42+
files: ./coverage.out
43+
flags: unittests
44+
fail_ci_if_error: false
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v3
48+
49+
- name: Log in to Container Registry
50+
if: github.event_name != 'pull_request'
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ${{ env.REGISTRY }}
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Extract metadata
58+
id: meta
59+
uses: docker/metadata-action@v5
60+
with:
61+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
62+
tags: |
63+
type=ref,event=branch
64+
type=ref,event=pr
65+
type=semver,pattern={{version}}
66+
type=semver,pattern={{major}}.{{minor}}
67+
type=semver,pattern={{major}}
68+
type=sha,prefix={{branch}}-
69+
type=raw,value=latest,enable={{is_default_branch}}
70+
71+
- name: Get version info
72+
id: version
73+
run: |
74+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
75+
VERSION="${{ github.ref_name }}"
76+
else
77+
VERSION="dev-$(git rev-parse --short HEAD)"
78+
fi
79+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
80+
echo "COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
81+
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
82+
83+
- name: Build and push container image
84+
uses: docker/build-push-action@v5
85+
with:
86+
context: .
87+
platforms: linux/amd64,linux/arm64
88+
push: ${{ github.event_name != 'pull_request' }}
89+
tags: ${{ steps.meta.outputs.tags }}
90+
labels: ${{ steps.meta.outputs.labels }}
91+
build-args: |
92+
VERSION=${{ steps.version.outputs.VERSION }}
93+
COMMIT=${{ steps.version.outputs.COMMIT }}
94+
BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }}
95+
cache-from: type=gha
96+
cache-to: type=gha,mode=max

.github/workflows/test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: '1.25'
25+
26+
- name: Download dependencies
27+
run: go mod download
28+
29+
- name: Run go fmt
30+
run: |
31+
if [ -n "$(go fmt ./...)" ]; then
32+
echo "Code is not formatted. Please run 'go fmt ./...'"
33+
exit 1
34+
fi
35+
36+
- name: Run go vet
37+
run: go vet ./...
38+
39+
- name: Run tests
40+
run: go test -v -race -coverprofile=coverage.out ./...
41+
42+
- name: Upload coverage
43+
uses: codecov/codecov-action@v4
44+
with:
45+
files: ./coverage.out
46+
flags: unittests
47+
fail_ci_if_error: false

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,11 @@ go.work.sum
3030
# Editor/IDE
3131
# .idea/
3232
# .vscode/
33+
34+
# Build artifacts
35+
bin/
36+
dist/
37+
38+
# Temporary files
39+
tmp/
40+
*.tmp

.golangci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
run:
2+
timeout: 5m
3+
tests: true
4+
modules-download-mode: readonly
5+
6+
linters:
7+
enable:
8+
- errcheck
9+
- gosimple
10+
- govet
11+
- ineffassign
12+
- staticcheck
13+
- typecheck
14+
- unused
15+
- gofmt
16+
- goimports
17+
- misspell
18+
- goconst
19+
- gocritic
20+
- gocyclo
21+
- revive
22+
23+
linters-settings:
24+
errcheck:
25+
check-type-assertions: true
26+
check-blank: true
27+
28+
govet:
29+
enable-all: true
30+
31+
gocyclo:
32+
min-complexity: 15
33+
34+
goconst:
35+
min-len: 3
36+
min-occurrences: 3
37+
38+
issues:
39+
exclude-use-default: false
40+
max-issues-per-linter: 0
41+
max-same-issues: 0
42+
43+
exclude-rules:
44+
- path: _test\.go
45+
linters:
46+
- errcheck
47+
- goconst

.serena/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/cache

0 commit comments

Comments
 (0)