Skip to content

Commit 21c0de9

Browse files
Merge pull request #1 from SebastienMelki/open_sourcefication
docs: add comprehensive project documentation
2 parents 5e782cc + 7487254 commit 21c0de9

File tree

19 files changed

+3197
-37
lines changed

19 files changed

+3197
-37
lines changed

.github/workflows/ci.yml

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
GO_VERSION: '1.24'
12+
BUF_VERSION: 'latest'
13+
14+
jobs:
15+
lint:
16+
name: Lint & Code Quality
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v5
21+
22+
- name: Setup Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: ${{ env.GO_VERSION }}
26+
cache: true
27+
28+
- name: Setup Buf
29+
uses: bufbuild/buf-setup-action@v1
30+
with:
31+
version: ${{ env.BUF_VERSION }}
32+
github_token: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Run golangci-lint
35+
uses: golangci/golangci-lint-action@v8
36+
with:
37+
version: latest
38+
args: ""
39+
40+
- name: Run Go fmt check
41+
run: |
42+
fmt_output=$(gofmt -l .)
43+
if [ -n "$fmt_output" ]; then
44+
echo "::error::The following files need formatting:"
45+
echo "$fmt_output" | while read -r file; do
46+
echo "::error file=$file::File needs gofmt formatting"
47+
done
48+
exit 1
49+
fi
50+
51+
- name: Run Go vet
52+
run: go vet ./...
53+
54+
- name: Run Buf lint
55+
run: buf lint
56+
57+
test:
58+
name: Test (Go ${{ matrix.go-version }} - ${{ matrix.os }})
59+
runs-on: ${{ matrix.os }}
60+
strategy:
61+
fail-fast: false
62+
matrix:
63+
go-version: ['1.24']
64+
os: [ubuntu-latest, macos-latest]
65+
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v5
68+
69+
- name: Setup Go
70+
uses: actions/setup-go@v5
71+
with:
72+
go-version: ${{ matrix.go-version }}
73+
cache: true
74+
75+
- name: Setup Buf
76+
uses: bufbuild/buf-setup-action@v1
77+
with:
78+
version: ${{ env.BUF_VERSION }}
79+
github_token: ${{ secrets.GITHUB_TOKEN }}
80+
81+
- name: Install dependencies
82+
run: make install
83+
84+
- name: Generate proto files
85+
run: make generate
86+
87+
- name: Run tests
88+
run: ./scripts/run_tests.sh --verbose
89+
shell: bash
90+
91+
- name: Upload test results
92+
if: always()
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: test-results-${{ matrix.os }}-go${{ matrix.go-version }}
96+
path: |
97+
coverage/coverage.out
98+
coverage/coverage.html
99+
coverage/coverage.json
100+
101+
coverage:
102+
name: Coverage Analysis
103+
runs-on: ubuntu-latest
104+
needs: test
105+
if: always()
106+
continue-on-error: true
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v5
110+
111+
- name: Download coverage from test job
112+
uses: actions/download-artifact@v5
113+
with:
114+
name: test-results-ubuntu-latest-go1.24
115+
path: ./coverage-download
116+
continue-on-error: true
117+
118+
- name: Setup Go for coverage tools
119+
uses: actions/setup-go@v5
120+
with:
121+
go-version: ${{ env.GO_VERSION }}
122+
123+
- name: Install go-test-coverage
124+
run: go install github.com/vladopajic/go-test-coverage/v2@latest
125+
126+
- name: Check coverage file
127+
run: |
128+
if [ -f "coverage-download/coverage.out" ]; then
129+
mkdir -p coverage
130+
cp coverage-download/coverage.out coverage/coverage.out
131+
echo "Coverage file found and copied"
132+
elif [ -f "coverage-download/coverage/coverage.out" ]; then
133+
mkdir -p coverage
134+
cp coverage-download/coverage/coverage.out coverage/coverage.out
135+
echo "Coverage file found in subfolder and copied"
136+
else
137+
echo "No coverage file found - this is expected for a new project"
138+
echo "Add tests to enable coverage reporting"
139+
exit 0
140+
fi
141+
142+
- name: Generate coverage badge and check thresholds
143+
if: success()
144+
run: |
145+
if [ -f "coverage/coverage.out" ]; then
146+
go-test-coverage --config=.testcoverage.yml || true
147+
fi
148+
continue-on-error: true
149+
150+
- name: Upload coverage to Codecov
151+
if: success() && github.event_name == 'pull_request'
152+
uses: codecov/codecov-action@v5
153+
with:
154+
file: ./coverage/coverage.out
155+
flags: unittests
156+
name: codecov-umbrella
157+
fail_ci_if_error: false
158+
token: ${{ secrets.CODECOV_TOKEN }}
159+
continue-on-error: true
160+
161+
- name: Upload coverage reports
162+
if: success()
163+
uses: actions/upload-artifact@v4
164+
with:
165+
name: coverage-reports
166+
path: |
167+
coverage/
168+
.testcoverage.yml
169+
continue-on-error: true
170+
171+
build:
172+
name: Build Binaries
173+
runs-on: ubuntu-latest
174+
needs: [lint, test]
175+
steps:
176+
- name: Checkout code
177+
uses: actions/checkout@v5
178+
179+
- name: Setup Go
180+
uses: actions/setup-go@v5
181+
with:
182+
go-version: ${{ env.GO_VERSION }}
183+
cache: true
184+
185+
- name: Setup Buf
186+
uses: bufbuild/buf-setup-action@v1
187+
with:
188+
version: ${{ env.BUF_VERSION }}
189+
github_token: ${{ secrets.GITHUB_TOKEN }}
190+
191+
- name: Install protoc-gen-go
192+
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
193+
194+
- name: Generate proto files
195+
run: make generate
196+
197+
- name: Build binaries
198+
run: make build
199+
200+
- name: Test binary execution
201+
run: |
202+
if [ -f "./bin/server" ]; then
203+
./bin/server --version || true
204+
else
205+
echo "Server binary not found - this is expected if not yet implemented"
206+
fi
207+
208+
- name: Upload binaries
209+
uses: actions/upload-artifact@v4
210+
with:
211+
name: binaries
212+
path: bin/
213+
214+
status-check:
215+
name: CI Status Summary
216+
runs-on: ubuntu-latest
217+
needs: [lint, test, coverage, build]
218+
if: always()
219+
steps:
220+
- name: Check CI status
221+
run: |
222+
echo "## CI Pipeline Summary"
223+
echo ""
224+
echo "- Lint: ${{ needs.lint.result }}"
225+
echo "- Test: ${{ needs.test.result }}"
226+
echo "- Coverage: ${{ needs.coverage.result }}"
227+
echo "- Build: ${{ needs.build.result }}"
228+
echo "- Proto Validation: ${{ needs.proto-validation.result }}"
229+
230+
if [ "${{ needs.lint.result }}" != "success" ] || \
231+
[ "${{ needs.test.result }}" != "success" ] || \
232+
[ "${{ needs.build.result }}" != "success" ]; then
233+
echo ""
234+
echo "❌ CI pipeline failed"
235+
exit 1
236+
else
237+
echo ""
238+
echo "✅ CI pipeline passed"
239+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ logs/
7272
/tmp/
7373

7474
# Coverage reports
75+
coverage/
7576
coverage.txt
7677
coverage.out
7778
coverage.html

0 commit comments

Comments
 (0)