-
Notifications
You must be signed in to change notification settings - Fork 0
192 lines (187 loc) · 6.16 KB
/
pr.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
name: pull-request
on:
pull_request:
branches:
- main
permissions: read-all
jobs:
# change set filter
changes:
runs-on: ubuntu-latest
outputs:
agent: ${{ steps.filter.outputs.agent }}
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: filter
with:
filters: |
agent:
- 'agent/*.toml'
- 'agent/*.lock'
- 'agent/src/*.rs'
- 'agent/src/**/*.rs'
- 'agent/build/df-rel-alpine.Dockerfile'
- 'agent/build/config/**'
- 'agent/build/s6/**'
backend:
- 'backend/go.mod'
- 'backend/go.sum'
- 'backend/main.go'
- 'backend/Makefile'
- 'backend/*.mk'
- 'backend/dockerfile-rel.s6.Dockerfile'
- 'backend/**/**'
frontend:
- 'frontend/package.json'
- 'frontend/package-lock.json'
- 'frontend/*.config.js'
- 'frontend/src/**'
- 'frontend/public/**'
# linters
lint-frontend:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.frontend == 'true' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
github.com:443
registry.npmjs.org:443
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # v2
with:
node-version: '16'
- run: make lint-frontend
working-directory: backend
lint-backend:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
proxy.golang.org:443
storage.googleapis.com:443
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: 1.20.3
- run: make lint-backend
working-directory: backend
lint-commits:
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'snyk-') && !startsWith(github.head_ref, 'dependabot/') }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
github.com:443
registry.yarnpkg.com:443
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # v2
with:
node-version: '16'
- run: make lint-commits
working-directory: backend
lint-agent:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.agent == 'true' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
static.rust-lang.org:443
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.6
with:
toolchain: nightly
components: rustfmt
override: true
- uses: LoliGothick/rustfmt-check@a86cbe9bddeb4dd029177643cf6d08270abbf9b7 # v0.3.2
with:
token: ${{ secrets.CODEQL_TOKEN }}
flags: --all
##options: --manifest-path=Cargo.toml
args: --config-path=agent/rustfmt.toml
working-directory: agent
lint:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [lint-frontend, lint-backend, lint-commits, lint-agent]
steps:
- run: echo "done"
# tests
test-frontend:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.frontend == 'true' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
github.com:443
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # v2
with:
node-version: '16'
- run: make test-frontend
working-directory: backend
test-backend:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.backend == 'true' }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
with:
egress-policy: audit
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
fetch-depth: 0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: 1.20.3
- run: make test-backend
working-directory: backend
test:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [test-frontend, test-backend]
steps:
- run: echo "done"