-
Notifications
You must be signed in to change notification settings - Fork 2
91 lines (76 loc) · 2.68 KB
/
ci-agent.yml
File metadata and controls
91 lines (76 loc) · 2.68 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
# CI:Runner Agent 的测试与构建
name: CI (Agent)
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]
env:
GO_VERSION: "1.26.0"
WORKING_DIR: .
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Detect Go module root
id: modroot
uses: ./.github/actions/detect-go-module-root
with:
working_dir: ${{ env.WORKING_DIR }}
- name: Set up Go
if: steps.modroot.outputs.found == 'true'
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: ${{ steps.modroot.outputs.root }}/go.sum
- name: Vet
if: steps.modroot.outputs.found == 'true'
run: go vet ./cmd/runner-agent/... ./internal/...
working-directory: ${{ steps.modroot.outputs.root }}
- name: Lint
if: steps.modroot.outputs.found == 'true'
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --max-same-issues=100000 ./cmd/runner-agent/... ./internal/...
working-directory: ${{ steps.modroot.outputs.root }}
- name: Run tests
if: steps.modroot.outputs.found == 'true'
run: go test -v ./cmd/runner-agent/... ./internal/...
working-directory: ${{ steps.modroot.outputs.root }}
- name: Skip (no project structure)
if: steps.modroot.outputs.found != 'true'
run: 'echo "Skipped: no go.mod + cmd/runner-agent in this repo."'
build:
name: Build
runs-on: ubuntu-latest
needs: [test]
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Detect Go module root
id: modroot
uses: ./.github/actions/detect-go-module-root
with:
working_dir: ${{ env.WORKING_DIR }}
- name: Set up Go
if: steps.modroot.outputs.found == 'true'
uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: ${{ steps.modroot.outputs.root }}/go.sum
- name: Build Runner Agent
if: steps.modroot.outputs.found == 'true'
run: go build -o runner-agent ./cmd/runner-agent
working-directory: ${{ steps.modroot.outputs.root }}
- name: Verify binary
if: steps.modroot.outputs.found == 'true'
run: test -x runner-agent && ls -la runner-agent
working-directory: ${{ steps.modroot.outputs.root }}
- name: Skip (no project structure)
if: steps.modroot.outputs.found != 'true'
run: 'echo "Skipped: no go.mod + cmd/runner-agent in this repo."'