-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
87 lines (81 loc) · 2.87 KB
/
.gitlab-ci.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
include:
- project: code0-tech/development/telescopium
ref: build-branch
file: ci-template.gitlab-ci.yml
docs:
rules:
- if: $C0_UPDATE_SNAPSHOTS == null
docs:preview:
rules:
- if: $C0_UPDATE_SNAPSHOTS == null && $C0_GH_REF != "refs/heads/main"
storybook:build:
image: node:22.12.0
stage: build
script:
- npm ci
- npm run storybook:build
- |
echo -e "\e[0Ksection_start:`date +%s`:glpa_summary\r\e[0KHeader of the summary"
echo "Storybook available at https://code0-tech.gitlab.io/-/development/pictor/-/jobs/$CI_JOB_ID/artifacts/storybook-static/index.html"
echo -e "\e[0Ksection_end:`date +%s`:glpa_summary\r\e[0K"
environment:
name: storybook/$CI_COMMIT_REF_SLUG
url: https://code0-tech.gitlab.io/-/development/pictor/-/jobs/$CI_JOB_ID/artifacts/storybook-static/index.html
auto_stop_in: 7 days
artifacts:
paths:
- storybook-static
expire_in: 7 days
rules:
- if: $C0_UPDATE_SNAPSHOTS == null
.storybook:test:base:
image: ghcr.io/code0-tech/build-images/node-playwright:93.1-node-22.12
stage: test
before_script:
- source ~/.asdf/asdf.sh
- npm ci
- npm run storybook:dev &
- curl --fail -sv --retry 30 --retry-delay 3 --head --retry-all-errors http://127.0.0.1:6006
storybook:test:
extends:
- .storybook:test:base
script:
- npm run storybook:test:all -- --ci || exit_code=$?
- |
if [[ $exit_code -ne 0 && -d "__snapshots__/__diff_output__" ]]; then
echo -e "\e[0Ksection_start:`date +%s`:glpa_summary\r\e[0KHeader of the summary"
echo "Storybook tests failed."
echo "Check for rendering differences at https://gitlab.com/code0-tech/development/pictor/-/jobs/$CI_JOB_ID/artifacts/browse/__snapshots__/__diff_output__/"
echo "If the changes are intended, update the snapshots by adding the 'regenerate-snapshots' label."
echo -e "\e[0Ksection_end:`date +%s`:glpa_summary\r\e[0K"
fi
exit $exit_code
artifacts:
when: on_failure
paths:
- __snapshots__/__diff_output__
expire_in: 7 days
rules:
- if: $C0_UPDATE_SNAPSHOTS == null
storybook:test:update:
extends:
- .storybook:test:base
variables:
C0_DISABLE_A11Y_TESTS: 'true'
before_script:
- git remote add github $C0_GH_PR_HEAD_URL
- git fetch github
- git checkout $C0_GH_PR_HEAD_REF
- !reference [.storybook:test:base, before_script]
script:
- npm run storybook:test:update
- git add __snapshots__
- git config --global user.name "github-actions[bot]"
- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- git commit -m "Update image snapshots"
- >
git
-c credential.helper='!f() { sleep 1; echo "username=${C0_GH_BOT_PUSH_USERNAME}"; echo "password=${C0_GH_BOT_PUSH_ACCESS_TOKEN}"; }; f'
push github $C0_GH_PR_HEAD_REF
rules:
- if: $C0_UPDATE_SNAPSHOTS