@@ -3,8 +3,18 @@ name: CI
33on :
44 push :
55 branches : [ main, master ]
6+ paths-ignore :
7+ - ' **.md'
8+ - ' docs/**'
69 pull_request :
710 branches : [ main, master ]
11+ paths-ignore :
12+ - ' **.md'
13+ - ' docs/**'
14+
15+ concurrency :
16+ group : ${{ github.workflow }}-${{ github.ref }}
17+ cancel-in-progress : true
818
919env :
1020 GO_VERSION : ' 1.24.x'
@@ -13,20 +23,74 @@ permissions:
1323 contents : read
1424
1525jobs :
26+ pr-validation :
27+ name : 📋 PR Validation
28+ runs-on : ubuntu-latest
29+ if : github.event_name == 'pull_request'
30+ steps :
31+ - name : Checkout code
32+ uses : actions/checkout@v6
33+ with :
34+ fetch-depth : 0
35+
36+ - name : Validate PR Title
37+ uses : amannn/action-semantic-pull-request@v6
38+ env :
39+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40+ with :
41+ types : |
42+ feat
43+ fix
44+ docs
45+ style
46+ refactor
47+ perf
48+ test
49+ build
50+ ci
51+ chore
52+ deps
53+ revert
54+ scopes : |
55+ github
56+ api
57+ web
58+ auth
59+ config
60+ daemon
61+ scale
62+ server
63+ general
64+ requireScope : true
65+ subjectPattern : ^(?![A-Z]).+$
66+ subjectPatternError : |
67+ The subject must start with lowercase letter.
68+
1669 test :
1770 name : 🧪 Test and Coverage
1871 runs-on : ubuntu-latest
72+ timeout-minutes : 10 # 🛑 Hard limit
1973
2074 steps :
2175 - name : Checkout code
2276 uses : actions/checkout@v6
2377
78+ - name : Checkout Poster library
79+ uses : actions/checkout@v6
80+ with :
81+ repository : adcondev/poster
82+ path : poster
83+
2484 - name : Setup Go
2585 uses : actions/setup-go@v6
2686 with :
2787 go-version : ${{ env.GO_VERSION }}
2888 cache : true
2989
90+ - name : Patch Go modules for CI
91+ run : |
92+ go mod edit -replace github.com/adcondev/poster=./poster
93+
3094 - name : Run tests with race detection
3195 run : go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
3296
45109 flags : unittests
46110 name : codecov-ubuntu
47111 fail_ci_if_error : false
112+ token : ${{ secrets.CODECOV_TOKEN }}
48113
49114 benchmark :
50115 name : ⚡ Performance Benchmarks
@@ -61,6 +126,12 @@ jobs:
61126 with :
62127 fetch-depth : 0
63128
129+ - name : Checkout Poster library
130+ uses : actions/checkout@v6
131+ with :
132+ repository : adcondev/poster
133+ path : poster
134+
64135 - name : Setup Go
65136 uses : actions/setup-go@v6
66137 with :
@@ -70,14 +141,20 @@ jobs:
70141 - name : Run benchmarks (base)
71142 continue-on-error : true
72143 run : |
73- git clean -fdx
144+ # Ignore our cloned repos so git clean doesn't delete them
145+ git clean -fdx -e poster/
146+ git reset --hard
74147 git checkout ${{ github.event.pull_request.base.sha }}
75- go test -bench=. -benchmem -run=^$ ./... > /tmp/base-benchmark.txt 2>&1
148+ # Re-apply the patch because checkout restores the base go.mod
149+ go mod edit -replace github.com/adcondev/poster=./poster
150+ go test -bench=. -benchmem -run=^$ ./... > /tmp/base-benchmark.txt 2>&1 || true
76151
77152 - name : Run benchmarks (current)
78153 run : |
79- git clean -fdx
154+ git clean -fdx -e poster/
155+ git reset --hard
80156 git checkout ${{ github.event.pull_request.head.sha }}
157+ go mod edit -replace github.com/adcondev/poster=./poster
81158 go test -bench=. -benchmem -run=^$ ./... > /tmp/current-benchmark.txt 2>&1
82159
83160 - name : Compare benchmarks
92169 echo '```' >> benchmark-comment.md
93170 grep "^Benchmark" /tmp/current-benchmark.txt | head -20 >> benchmark-comment.md
94171 echo '```' >> benchmark-comment.md
95-
172+
96173 if grep -q "^Benchmark" /tmp/base-benchmark.txt; then
97174 echo "" >> benchmark-comment.md
98175 echo "### 📊 Base Branch Results" >> benchmark-comment.md
@@ -152,15 +229,70 @@ jobs:
152229 - name : Checkout code
153230 uses : actions/checkout@v6
154231
232+ - name : Checkout Poster library
233+ uses : actions/checkout@v6
234+ with :
235+ repository : adcondev/poster
236+ path : poster
237+
155238 - name : Setup Go
156239 uses : actions/setup-go@v6
157240 with :
158241 go-version : ${{ env.GO_VERSION }}
159242 cache : true
160243
244+ - name : Patch Go modules for CI
245+ run : |
246+ go mod edit -replace github.com/adcondev/poster=./poster
247+
161248 - name : Run golangci-lint
162249 uses : golangci/golangci-lint-action@v9
163250 with :
164251 version : latest
165252 skip-cache : false
166- args : --config=./.golangci.yml --timeout=5m
253+ args : --config=.golangci.yml --timeout=5m
254+
255+ build :
256+ name : 🏗️ Build Check
257+ runs-on : ubuntu-latest
258+ needs : test # Only build if tests pass
259+ steps :
260+ - name : Checkout code
261+ uses : actions/checkout@v6
262+
263+ - name : Checkout Poster library
264+ uses : actions/checkout@v6
265+ with :
266+ repository : adcondev/poster
267+ path : poster
268+
269+ - name : Setup Go
270+ uses : actions/setup-go@v6
271+ with :
272+ go-version : ${{ env.GO_VERSION }}
273+ cache : true
274+
275+ - name : Patch Go modules for CI
276+ run : |
277+ go mod edit -replace github.com/adcondev/poster=./poster
278+
279+ - name : Install Task
280+ uses : arduino/setup-task@v2
281+ with :
282+ version : 3.x
283+ repo-token : ${{ secrets.GITHUB_TOKEN }}
284+
285+ - name : Build via Taskfile
286+ env :
287+ GOOS : windows
288+ GOARCH : amd64
289+ SCALE_AUTH_TOKEN : ${{ secrets.SCALE_AUTH_TOKEN || 'build-token' }}
290+ SCALE_DASHBOARD_HASH : ${{ secrets.SCALE_DASHBOARD_HASH || '' }}
291+ BUILD_ENV : ' remote'
292+ run : |
293+ task build
294+
295+ echo "## 📦 Build Artifact" >> $GITHUB_STEP_SUMMARY
296+ echo "| File | Size |" >> $GITHUB_STEP_SUMMARY
297+ echo "|------|------|" >> $GITHUB_STEP_SUMMARY
298+ ls -lh bin/*.exe | awk '{print "| " $9 " | " $5 " |"}' >> $GITHUB_STEP_SUMMARY
0 commit comments