-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (74 loc) · 2.79 KB
/
Copy pathci.yml
File metadata and controls
89 lines (74 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# TaskFlow CI Pipeline
#
# Runs on every push and pull request to the main branch:
# 1. Lint — go fmt + go vet
# 2. Test (race) — all unit + integration tests with the Go race detector
# 3. Binary build — produces the taskflow binary and runs a smoke test
#
# Targets delegate to the Makefile for consistency between local and CI.
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
GO_VERSION: "1.24"
CGO_ENABLED: "1"
jobs:
# ─────────────────────────────────────────────────────────────
# Test — lint, build, vet, and run all tests with race detector
# ─────────────────────────────────────────────────────────────
test:
name: Lint + test (race)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Lint
run: make lint
- name: Build
run: make build
- name: Test (race detector)
run: make race
# ─────────────────────────────────────────────────────────────
# Binary — build the production binary and upload as artifact
# ─────────────────────────────────────────────────────────────
binary:
name: Build binary + smoke test
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Build binary
run: make build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: taskflow-linux-amd64
path: taskflow
retention-days: 7
- name: Smoke test
run: |
chmod +x taskflow
PORT=9090 timeout 10 ./taskflow &
SERVER_PID=$!
sleep 2
HTTP_CODE=$(curl --max-time 3 -s -o /dev/null -w "%{http_code}" http://localhost:9090/ 2>/dev/null || echo "failed")
kill $SERVER_PID 2>/dev/null
if [ "$HTTP_CODE" = "302" ]; then
echo "✅ Server started and responded with redirect (302)"
else
echo "⚠️ Server responded with HTTP $HTTP_CODE (expected 302)"
fi