-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (94 loc) · 2.53 KB
/
Copy pathcompuite-agent-ci.yml
File metadata and controls
108 lines (94 loc) · 2.53 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Compute Agent CI
on:
push:
branches: [ main, master ]
paths:
- 'compute-agent/**'
- 'pkg/**'
- 'sdk/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/compute-agent-ci.yml'
pull_request:
branches: [ main, master ]
paths:
- 'compute-agent/**'
- 'pkg/**'
- 'sdk/**'
- 'go.mod'
- 'go.sum'
- '.github/workflows/compute-agent-ci.yml'
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: compute-agent/go.mod # Point to service go.mod
cache: true
- name: Run unit tests with race and coverage
run: |
cd compute-agent
make test-unit || go test ./... -race -coverprofile=coverage.txt
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: unit-coverage
path: compute-agent/coverage.txt
if-no-files-found: warn
e2e-tests:
name: End-to-End Tests
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: compute-agent/go.mod
cache: true
- name: Run end-to-end tests
run: |
cd compute-agent
make test-e2e
build-binaries:
name: Build Binaries
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: compute-agent/go.mod
cache: true
- name: Build agent and client
run: |
cd compute-agent
go build -v ./cmd/agent
go build -v ./examples/client
docker-build:
name: Docker Build
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build optimized runtime image
uses: docker/build-push-action@v6
with:
context: . # Root context (needed for pkg/)
file: ./compute-agent/Dockerfile
target: runtime
push: false
tags: persys/compute-agent:ci-runtime
cache-from: type=gha
cache-to: type=gha,mode=max