-
Notifications
You must be signed in to change notification settings - Fork 44
199 lines (175 loc) · 6.12 KB
/
CI.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: CI
on:
pull_request:
push:
branches:
- master
schedule:
- cron: "0 18 * * *" # TimeZone: UTC 0
concurrency:
group: skywalking-cli-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check-license:
name: License header
if: (github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check License Header
uses: apache/skywalking-eyes@5dfa68f93380a5e57259faaf95088b7f133b5778
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.18"
- name: Check Dependencies License
run: make dependency-license
changes:
runs-on: ubuntu-latest
if: github.event_name != 'schedule'
timeout-minutes: 10
outputs:
cli: ${{ steps.filter-cli.outputs.any_modified }}
steps:
- uses: actions/checkout@v3 # required for push event
with:
fetch-depth: 0
- name: Check for CLI source changes
id: filter-cli
# The GHA version is pinned by infra
uses: tj-actions/changed-files@v43.0.0
with:
files_from_source_file: .github/file-filters.txt
- name: List all modified files
if: steps.filter-cli.outputs.any_modified == 'true'
run: |
echo "Files that have changed or modified:"
echo "Filter-cli: ${{ steps.filter-cli.outputs.all_changed_and_modified_files }}"
golang-lint:
name: Golang Lint
runs-on: ubuntu-latest
needs: [changes]
if: |
( always() && ! cancelled() ) &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true')
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.0
args: --timeout 5m
build:
name: Build
needs: [changes]
runs-on: ubuntu-latest
if: |
( always() && ! cancelled() ) &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true')
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Check code generation
run: make check-codegen
- uses: actions/upload-artifact@v3
if: failure()
with:
name: check-diff
path: /tmp/swctl/check.diff
- name: Build
run: make build -j3
- name: Build Docker images
run: make docker
command-tests:
name: Command Tests
runs-on: ubuntu-latest
needs: [changes]
if: |
( always() && ! cancelled() ) &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true')
strategy:
matrix:
oap:
- a65a6e0ff2ef9c716131b36172399076307c35f1 # Feb 27th, 2024
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Test commands
uses: apache/skywalking-infra-e2e@cf589b4a0b9f8e6f436f78e9cfd94a1ee5494180
env:
OAP_TAG: ${{ matrix.oap }}
with:
e2e-file: test/cases/basic/test.yaml
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: [changes]
if: |
( always() && ! cancelled() ) &&
((github.event_name == 'schedule' && github.repository == 'apache/skywalking-cli') || needs.changes.outputs.cli == 'true')
steps:
- uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v4
with:
go-version: '1.18'
- name: run unit tests and report coverage
working-directory: ./
run: |
make coverage
required:
if: always()
name: Required
needs:
- check-license
- golang-lint
- build
- command-tests
- unit-tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Merge Requirement
run: |
execute=${{ needs.changes.outputs.cli }}
checkLicense=${{ needs.check-license.result }}
[[ ${checkLicense} == 'success' ]] || exit -1;
golangLint=${{ needs.golang-lint.result }};
build=${{ needs.build.result }};
commandTests=${{ needs.command-tests.result }};
unitTests=${{ needs.unit-tests.result }};
[[ ${golangLint} == 'success' ]] || [[ ${execute} != 'true' && ${golangLint} == 'skipped' ]] || exit -2;
[[ ${build} == 'success' ]] || [[ ${execute} != 'true' && ${build} == 'skipped' ]] || exit -3;
[[ ${commandTests} == 'success' ]] || [[ ${execute} != 'true' && ${commandTests} == 'skipped' ]] || exit -4;
[[ ${unitTests} == 'success' ]] || [[ ${execute} != 'true' && ${unitTests} == 'skipped' ]] || exit -5;
exit 0;