1+ name : Compute Agent CI
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ paths :
7+ - ' compute-agent/**'
8+ - ' pkg/**'
9+ - ' sdk/**'
10+ - ' go.mod'
11+ - ' .github/workflows/compute-agent-ci.yml'
12+ pull_request :
13+ branches : [ main, master ]
14+ paths :
15+ - ' compute-agent/**'
16+ - ' pkg/**'
17+ - ' sdk/**'
18+ - ' go.mod'
19+ - ' .github/workflows/compute-agent-ci.yml'
20+
21+ jobs :
22+ unit-tests :
23+ name : Unit Tests
24+ runs-on : ubuntu-latest
25+ steps :
26+ - name : Checkout
27+ uses : actions/checkout@v4
28+
29+ - name : Setup Go
30+ uses : actions/setup-go@v5
31+ with :
32+ go-version-file : go.work # Better for monorepo
33+ cache : true
34+
35+ - name : Run unit tests with race and coverage
36+ run : |
37+ cd compute-agent
38+ make test-unit # or go test ./... -race -coverprofile=coverage.txt
39+
40+ - name : Upload coverage artifact
41+ uses : actions/upload-artifact@v4
42+ with :
43+ name : unit-coverage
44+ path : compute-agent/coverage.txt
45+ if-no-files-found : warn
46+
47+ e2e-tests :
48+ name : End-to-End Tests
49+ runs-on : ubuntu-latest
50+ needs : [unit-tests]
51+ steps :
52+ - name : Checkout
53+ uses : actions/checkout@v4
54+
55+ - name : Setup Go
56+ uses : actions/setup-go@v5
57+ with :
58+ go-version-file : go.work
59+ cache : true
60+
61+ - name : Run end-to-end tests
62+ run : |
63+ cd compute-agent
64+ make test-e2e
65+
66+ build-binaries :
67+ name : Build Binaries
68+ runs-on : ubuntu-latest
69+ needs : [unit-tests]
70+ steps :
71+ - name : Checkout
72+ uses : actions/checkout@v4
73+
74+ - name : Setup Go
75+ uses : actions/setup-go@v5
76+ with :
77+ go-version-file : go.work
78+ cache : true
79+
80+ - name : Build agent and client
81+ run : |
82+ cd compute-agent
83+ go build -v ./cmd/agent
84+ go build -v ./examples/client
85+
86+ docker-build :
87+ name : Docker Build
88+ runs-on : ubuntu-latest
89+ needs : [unit-tests]
90+ steps :
91+ - name : Checkout
92+ uses : actions/checkout@v4
93+
94+ - name : Set up Docker Buildx
95+ uses : docker/setup-buildx-action@v3
96+
97+ - name : Build optimized runtime image
98+ uses : docker/build-push-action@v6
99+ with :
100+ context : . # Root context
101+ file : ./compute-agent/Dockerfile
102+ target : runtime
103+ push : false
104+ tags : persys/compute-agent:ci-runtime
105+ cache-from : type=gha
106+ cache-to : type=gha,mode=max
107+
108+ - name : Build full runtime image
109+ uses : docker/build-push-action@v6
110+ with :
111+ context : .
112+ file : ./compute-agent/Dockerfile
113+ target : full-runtime
114+ push : false
115+ tags : persys/compute-agent:ci-full-runtime
116+ cache-from : type=gha
117+ cache-to : type=gha,mode=max
0 commit comments