-
Notifications
You must be signed in to change notification settings - Fork 7
267 lines (257 loc) · 9.3 KB
/
improvedci.yml
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: Facia-Tool CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
generate_build_number:
name: Generate build number
runs-on: ubuntu-20.04
outputs:
BUILD_NUMBER: ${{ steps.create-build-number.outputs.BUILD_NUMBER }}
steps:
- id: create-build-number
name: Create build number
run: |
LAST_TEAMCITY_BUILD=7962
echo "BUILD_NUMBER=$(( $GITHUB_RUN_NUMBER + $LAST_TEAMCITY_BUILD ))" >> "$GITHUB_OUTPUT"
build_client_v1:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package-lock.json
- name: Set up grunt
run: npm i -g grunt-cli
- name: Install NPM dependencies
run: npm install
- name: Set up JSPM
env:
JSPM_GITHUB_AUTH_SECRET: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run jspm config registries.github.auth ${JSPM_GITHUB_AUTH_SECRET}
npm run jspm registry export github
- name: Install JSPM dependencies
run: npm run jspm install
- name: Build frontend v1
run: |
grunt --stack bundle
- uses: actions/upload-artifact@v4
with:
name: fronts-client-v1
path: public/fronts-client-v1
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: jspm-packages
path: public/src/jspm_packages
if-no-files-found: error
test_client_v1:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: package-lock.json
- name: Set up grunt
run: npm i -g grunt-cli
- name: Install NPM dependencies
run: npm install
- name: Set up JSPM
env:
JSPM_GITHUB_AUTH_SECRET: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run jspm config registries.github.auth ${JSPM_GITHUB_AUTH_SECRET}
npm run jspm registry export github
- name: Install JSPM dependencies
run: npm run jspm install
- name: Test frontend v1
run: |
grunt --stack validate
grunt --stack test
build_client_v2:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: fronts-client/.nvmrc
cache: yarn
cache-dependency-path: fronts-client/yarn.lock
- run: yarn install --frozen-lockfile
working-directory: fronts-client
- run: yarn lint
working-directory: fronts-client
- run: yarn build
working-directory: fronts-client
- uses: actions/upload-artifact@v4
with:
name: fronts-client-v2
path: public/fronts-client-v2
if-no-files-found: error
test_client_v2:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: fronts-client/.nvmrc
cache: yarn
cache-dependency-path: fronts-client/yarn.lock
- run: yarn install --frozen-lockfile
working-directory: fronts-client
- run: yarn test
working-directory: fronts-client
integrationtest_client_v2:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
needs:
- build_client_v2
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: fronts-client/.nvmrc
cache: yarn
cache-dependency-path: fronts-client/yarn.lock
- uses: actions/download-artifact@v4 #integration test requires built frontend (of course!)
with:
path: public/fronts-client-v2
name: fronts-client-v2
- run: yarn install --frozen-lockfile
working-directory: fronts-client
- run: yarn test-integration-ci
working-directory: fronts-client
test_backend:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
services:
# See https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers
postgres:
image: postgres:10.7-alpine
env:
POSTGRES_USER: faciatool
POSTGRES_PASSWORD: faciatool
POSTGRES_DB: faciatool
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 4724:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "corretto"
cache: "sbt"
- name: Run tests
run: sbt 'test; database-int:test'
lint_backend:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "corretto"
cache: "sbt"
- name: Check scala formatting
run: sbt 'scalafmtCheck; scalafmtSbtCheck;'
build_backend:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
needs:
- build_client_v1
- build_client_v2
- generate_build_number
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: public/fronts-client-v1
name: fronts-client-v1
- uses: actions/download-artifact@v4
with:
path: public/fronts-client-v2
name: fronts-client-v2
- uses: actions/download-artifact@v4
with:
name: jspm-packages
path: public/src/jspm_packages
- name: Set GITHUB_RUN_NUMBER environment variable
run: |
echo "GITHUB_RUN_NUMBER=${{ needs.generate_build_number.outputs.BUILD_NUMBER }}" >> $GITHUB_ENV
- uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "corretto"
cache: "sbt"
- name: Bundle
run: sbt debian:packageBin
- uses: actions/upload-artifact@v4
with:
name: build-package
path: target/facia-tool_1.0_all.deb
if-no-files-found: error
compression-level: '0' #no point, it's already compressed
upload:
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
pull-requests: write
needs:
- generate_build_number
- test_client_v1
- test_client_v2
- test_backend
- build_backend
- integrationtest_client_v2
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: target/facia-tool_1.0_all.deb
name: build-package
- name: Set GITHUB_RUN_NUMBER environment variable
run: |
echo "GITHUB_RUN_NUMBER=${{ needs.generate_build_number.outputs.BUILD_NUMBER }}" >> $GITHUB_ENV
- uses: guardian/actions-riff-raff@v4
with:
app: facia-tool
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
buildNumber: ${{ env.GITHUB_RUN_NUMBER }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
configPath: riff-raff.yaml
contentDirectories: |
facia-tool:
- target/facia-tool_1.0_all.deb