-
Notifications
You must be signed in to change notification settings - Fork 15
787 lines (767 loc) · 26.2 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
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
name: CI
on:
push:
branches: [main]
pull_request:
release:
types: [published]
workflow_dispatch:
repository_dispatch:
types: [start-ci, deploy-demo]
env:
ELIXIR_VERSION: 1.14.3
OTP_VERSION: 25
MIX_ENV: test
NODE_VERSION: "16"
jobs:
elixir-deps:
name: Elixir dependencies (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: 1.14.3
otp: 25
- elixir: 1.13.4
otp: 22
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
env:
ImageOS: ubuntu20
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile --warnings-as-errors
mix dialyzer --plt
npm-deps:
name: Npm dependencies
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install NPM dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: cd assets && npm install
codespell:
name: Check common misspellings
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install codespell
run: |
sudo apt-get install -y git python3 python3-pip
python3 -m pip install codespell
- name: codespell
run: codespell -S priv*,*package*json,deps*,*node_modules*,*svg,*.git,*.app -L enque,daa
generate-docs:
name: Generate project documentation
runs-on: ubuntu-20.04
if: github.event_name == 'push' && github.ref_name == 'main'
steps:
- uses: actions/checkout@v4
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Build docs
uses: lee-dohm/generate-elixir-docs@v1
- name: Generate openapi.json
run: mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.V1.ApiSpec
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1
with:
output: ./doc/swaggerui
spec-file: openapi.json
- name: Publish to Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc
static-code-analysis:
name: Static Code Analysis
needs: [elixir-deps, npm-deps, api-bc-check]
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
env:
ImageOS: ubuntu20
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve Elixir Cached Dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v3
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Check for unused dependencies
run: mix deps.unlock --check-unused
- name: Check Code Format
run: mix format --check-formatted
- name: Run Credo
run: mix credo
- name: Run Dialyzer
run: mix dialyzer
- name: Run Eslint
run: cd assets && npm run lint
- name: Check JS Code Format
run: cd assets && npm run format:check
test-fe:
name: Run FE tests
needs: npm-deps
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v3
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Run JS tests
run: cd assets && npm test
test:
name: Test (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
needs: [elixir-deps, api-bc-check]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: 1.14.3
otp: 25
- elixir: 1.13.4
otp: 22
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: trento_test
ports:
- 5433:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
rabbitmq:
image: rabbitmq
env:
RABBITMQ_DEFAULT_USER: trento
RABBITMQ_DEFAULT_PASS: trento
ports:
- 5673:5672
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}
- name: Compile
run: mix compile --warnings-as-errors
- name: Run test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mix coveralls.github --warnings-as-errors --trace
chromatic:
name: Chromatic deployment
needs: [elixir-deps, npm-deps]
runs-on: ubuntu-20.04
if: github.event_name != 'repository_dispatch'
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v3
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Build CSS
run: npx tailwindcss --input=css/app.css --output=../priv/static/assets/app.css --postcss
working-directory: assets
- name: Build Frontend
run: npm run build
working-directory: assets
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
workingDir: assets
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: true
skip: dependabot/**
npm-e2e-deps:
name: Npm E2E dependencies
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: npm-e2e-cache
with:
path: |
test/e2e/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('test/e2e/package-lock.json') }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install E2E NPM dependencies
if: steps.npm-e2e-cache.outputs.cache-hit != 'true'
run: cd test/e2e && npm install
test-e2e:
name: End to end tests
needs: [elixir-deps, npm-deps, npm-e2e-deps, api-bc-check]
runs-on: ubuntu-20.04
env:
MIX_ENV: dev
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: trento_dev
ports:
- 5433:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
grafana:
image: grafana/grafana:8.3.5
ports:
- 3000:3000
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
env:
ImageOS: ubuntu20
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: |
deps
_build/dev
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Retrieve NPM Cached Dependencies
uses: actions/cache@v3
id: npm-cache
with:
path: |
assets/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('assets/package-lock.json') }}
- name: Retrieve E2E NPM Cached Dependencies
uses: actions/cache@v3
id: npm-e2e-cache
with:
path: |
test/e2e/node_modules
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('test/e2e/package-lock.json') }}
- name: Check Eslint and JS Code Format
run: cd test/e2e && npm run lint && npm run format:check
- name: Mix setup
run: mix setup
- name: Run trento detached
run: mix phx.server &
- name: Install photofinish
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: trento-project/photofinish
tag: v1.2.2
cache: enable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Give executable permissions to photofinish
run: chmod +x $(whereis photofinish | cut -d" " -f2)
- name: Cypress run
uses: cypress-io/github-action@v6
env:
cypress_video: false
cypress_db_host: postgres
cypress_db_port: 5432
cypress_photofinish_binary: $(whereis photofinish | cut -d" " -f2)
with:
working-directory: test/e2e
wait-on-timeout: 30
config: baseUrl=http://localhost:4000
- name: Upload cypress test screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: e2e-screenshots
path: test/e2e/cypress/screenshots/
main-branch-deps:
name: Rebuild main branch dependencies
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
if: github.ref_name != 'main'
with:
access_token: ${{ github.token }}
- name: Set up Elixir
uses: erlef/setup-beam@v1
if: github.ref_name != 'main'
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Checkout main branch
uses: actions/checkout@v4
if: github.ref_name != 'main'
with:
ref: main
- name: Retrieve Cached Dependencies - main branch
uses: actions/cache@v3
id: mix-cache-main
if: github.ref_name != 'main'
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Install missing dependencies
if: steps.mix-cache-main.outputs.cache-hit != 'true' && github.ref_name != 'main'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile --warnings-as-errors
mix dialyzer --plt
api-bc-check:
name: API bc check
needs: [elixir-deps, main-branch-deps]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- version: V1
- version: V2
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Checkout current branch
uses: actions/checkout@v4
- name: Retrieve Cached Dependencies - current branch
uses: actions/cache@v3
id: mix-cache-current
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Generate current openapi.json
run: |
mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.${{ matrix.version }}.ApiSpec /tmp/specs/current-spec.json
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
- name: Retrieve Cached Dependencies - main branch
uses: actions/cache@v3
id: mix-cache-main
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('mix.lock') }}
- name: Generate main openapi.json
run: |
mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.${{ matrix.version }}.ApiSpec /tmp/specs/main-spec.json
- name: Locate generated specs
run: mv /tmp/specs .
- name: Find difference between OpenAPI specifications
run: |
docker run -v "$(pwd)/specs:/specs" --rm openapitools/openapi-diff:2.0.1 \
/specs/main-spec.json \
/specs/current-spec.json \
--fail-on-incompatible \
--markdown /specs/changes.md \
--json /specs/changes.json \
--text /specs/changes.txt \
--html /specs/changes.html
- name: Upload OpenAPI diff report
uses: actions/upload-artifact@v3
if: failure()
with:
name: openapi-diff-report-${{ matrix.version }}
path: specs/
build-and-push-container-images:
name: Build and push container images
runs-on: ubuntu-latest
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [static-code-analysis, test, test-fe, test-e2e]
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/trento-web
IMAGE_TAG: "${{ (github.event_name == 'release' && github.event.release.tag_name) || (github.event_name == 'push' && github.ref_name == 'main' && 'rolling') || github.sha }}"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.IMAGE_REPOSITORY }}
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-demo-img:
name: Build the docker image for the demo environment
runs-on: ubuntu-latest
if: github.event.action == 'deploy-demo' || github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [static-code-analysis, test, test-fe]
permissions:
contents: read
packages: write
env:
MIX_ENV: demo
REGISTRY: ghcr.io
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}/trento-web
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
with:
images: ${{ env.IMAGE_REPOSITORY }}
- name: Build and push container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_REPOSITORY }}:demo
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: MIX_ENV=demo
deploy-demo-env:
name: Deploy updated images to the demo environment
runs-on: self-hosted
if: (vars.DEPLOY_DEMO == 'true' || github.event.action == 'deploy-demo') && (github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch')
env:
IMAGE_REPOSITORY: ghcr.io/${{ github.repository_owner }}
needs: [build-demo-img, test-e2e]
steps:
- name: Start a local k8s cluster
uses: jupyterhub/action-k3s-helm@v3
with:
k3s-channel: latest
- name: Add bitnami helm deps
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: Download and unzip helm chart
run: |
rm rolling.zip | true
rm -rf helm-charts-rolling | true
wget https://github.com/trento-project/helm-charts/archive/refs/tags/rolling.zip
unzip rolling.zip
- name: Install trento-server helm chart
run: |
cd helm-charts-rolling/charts/trento-server
helm dependency update
helm upgrade -i trento --wait . \
--set trento-web.adminUser.password="${{ secrets.DEMO_PASSWORD }}" \
--set trento-web.image.pullPolicy=Always \
--set trento-web.image.repository="${IMAGE_REPOSITORY}/trento-web" \
--set trento-web.image.tag="demo" \
--set trento-wanda.image.pullPolicy=Always \
--set trento-wanda.image.repository="${IMAGE_REPOSITORY}/trento-wanda" \
--set trento-wanda.image.tag="demo"
run-photofinish-demo-env:
name: Use photofinish to push mock data to the demo environment
runs-on: ubuntu-20.04
if: vars.DEPLOY_DEMO == 'true' && (github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch')
needs: deploy-demo-env
env:
TRENTO_DEMO_IP: ${{ secrets.TRENTO_DEMO_IP }}
TRENTO_API_KEY: ${{ secrets.TRENTO_API_KEY }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install photofinish
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: trento-project/photofinish
tag: v1.2.2
cache: enable
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Give executable permissions to photofinish
run: chmod +x $(whereis photofinish | cut -d" " -f2)
- name: Push data
run: photofinish run healthy-27-node-SAP-cluster -u "http://$TRENTO_DEMO_IP/api/collect" "$TRENTO_API_KEY"
obs-commit:
name: Commit the project on OBS
runs-on: ubuntu-20.04
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [static-code-analysis, test, test-fe, test-e2e]
container:
image: ghcr.io/trento-project/continuous-delivery:main
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEST_FOLDER: "/tmp/osc_project"
NAME: trento-web-image
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
FOLDER: packaging/suse
REPOSITORY: ${{ github.repository }}
options: -u 0:0
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
- uses: actions-ecosystem/action-get-latest-tag@v1
id: latest-tag
with:
semver_only: true
initial_version: 0.0.1
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install assets
run: cd assets && npm install
- name: Get mix deps
run: mix local.hex --force && mix deps.clean --all && mix deps.get
- name: Configure OSC
# OSC credentials must be configured beforehand as the HOME variables cannot be changed from /github/home
# that is used to run osc commands
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- name: Prepare .changes file
# The .changes file is updated only in release creation. This current task should be improved
# in order to add the current rolling release notes
if: github.event_name == 'release'
run: |
CHANGES_FILE=$NAME.changes
osc checkout $OBS_PROJECT $NAME $CHANGES_FILE
mv $CHANGES_FILE $FOLDER
VERSION=${{ steps.latest-tag.outputs.tag }}
hack/gh_release_to_obs_changeset.py $REPOSITORY -a shap-staff@suse.de -t $VERSION -f $FOLDER/$CHANGES_FILE
- name: Set version
run: |
git config --global --add safe.directory /__w/web/web
VERSION=$(./hack/get_version_from_git.sh)
# "+" character is not allowed in OBS dockerfile version strings
VERSION=${VERSION//[+]/-}
sed -i 's~%%VERSION%%~'"${VERSION}"'~' packaging/suse/Dockerfile
- name: Commit on OBS
run: |
OBS_PACKAGE=$OBS_PROJECT/$NAME
osc checkout $OBS_PACKAGE -o $DEST_FOLDER
cp -r packaging/suse/* $DEST_FOLDER
tar --transform 's,^./,/web/,' -zcvf $DEST_FOLDER/web.tar.gz --exclude=./.git ./*
cd $DEST_FOLDER
osc ar
osc commit -m "New development version of $NAME released"