-
Notifications
You must be signed in to change notification settings - Fork 10
88 lines (77 loc) · 2.42 KB
/
pr-golang-check.yaml
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
name: Golangci
on:
push:
branches:
- main
paths:
- '.github/workflows/pr-golang-check.yaml'
- 'service/eventlog-server/**.go'
- 'service/measurement-server/**.go'
- 'sdk/golang/ccnp/measurement/**.go'
- 'sdk/golang/ccnp/quote/**.go'
- 'sdk/golang/ccnp/eventlog/**.go'
pull_request:
paths:
- '.github/workflows/pr-golang-check.yaml'
- 'service/eventlog-server/**.go'
- 'service/measurement-server/**.go'
- 'sdk/golang/ccnp/measurement/**.go'
- 'sdk/golang/ccnp/quote/**.go'
- 'sdk/golang/ccnp/eventlog/**.go'
workflow_dispatch:
permissions:
contents: read
jobs:
golangci-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- name: get changed file
id: changed-files
uses: tj-actions/changed-files@v41
with:
separator: ","
- name: golangci-lint-for-eventlog-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/eventlog-server')
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
working-directory: './service/eventlog-server'
- name: golangci-lint-for-measurement-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/measurement-server')
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
working-directory: './service/measurement-server'
golangci-unit-test:
needs: golangci-lint
runs-on: [self-hosted, tdvm-ut]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- name: get changed file
id: changed-files
uses: tj-actions/changed-files@v41
with:
separator: ","
- name: golang-unit-test-for-eventlog-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/eventlog-server')
run: |
cd service/eventlog-server
make test
- name: golangci-unit-test-for-measurement-server
if: contains(steps.changed-files.outputs.all_changed_files, 'service/measurement-server')
run: |
cd service/measurement-server
make test