@@ -3,6 +3,10 @@ include:
33 ref : build-branch
44 file : ci-template.gitlab-ci.yml
55
6+ docs :
7+ rules :
8+ - if : $C0_UPDATE_SNAPSHOTS == null
9+
610storybook:build :
711 image : node:20.9.0
812 stage : build
@@ -21,22 +25,29 @@ storybook:build:
2125 paths :
2226 - storybook-static
2327 expire_in : 7 days
28+ rules :
29+ - if : $C0_UPDATE_SNAPSHOTS == null
2430
25- storybook:test :
31+ . storybook:test:base :
2632 image : ghcr.io/code0-tech/build-images/node-20.9-playwright:6.1
2733 stage : test
28- script :
34+ before_script :
2935 - source ~/.asdf/asdf.sh
3036 - npm ci
3137 - npm run storybook:dev &
3238 - curl --fail -sv --retry 30 --retry-delay 3 --head --retry-all-errors http://127.0.0.1:6006
39+
40+ storybook:test :
41+ extends :
42+ - .storybook:test:base
43+ script :
3344 - npm run storybook:test:all -- --ci || exit_code=$?
3445 - |
3546 if [[ $exit_code -ne 0 && -d "__snapshots__/__diff_output__" ]]; then
3647 echo -e "\e[0Ksection_start:`date +%s`:glpa_summary\r\e[0KHeader of the summary"
3748 echo "Storybook tests failed."
3849 echo "Check for rendering differences at http://gitlab.com/code0-tech/pictor/-/jobs/$CI_JOB_ID/artifacts/browse/__snapshots__/__diff_output__/"
39- echo "If the changes are intended, update the fixtures with npm run storybook:test:update "
50+ echo "If the changes are intended, update the snapshots by adding the 'regenerate-snapshots' label. "
4051 echo -e "\e[0Ksection_end:`date +%s`:glpa_summary\r\e[0K"
4152 fi
4253 exit $exit_code
@@ -45,3 +56,26 @@ storybook:test:
4556 paths :
4657 - __snapshots__/__diff_output__
4758 expire_in : 7 days
59+ rules :
60+ - if : $C0_UPDATE_SNAPSHOTS == null
61+
62+ storybook:test:update :
63+ extends :
64+ - .storybook:test:base
65+ before_script :
66+ - git remote add github $C0_GH_PR_HEAD_URL
67+ - git fetch github
68+ - git checkout $C0_GH_PR_HEAD_REF
69+ - !reference [.storybook:test:base, before_script]
70+ script :
71+ - npm run storybook:test:update
72+ - git add __snapshots__
73+ - git config --global user.name "github-actions[bot]"
74+ - git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
75+ - git commit -m "Update image snapshots"
76+ - >
77+ git
78+ -c credential.helper='!f() { sleep 1; echo "username=${C0_GH_BOT_PUSH_USERNAME}"; echo "password=${C0_GH_BOT_PUSH_ACCESS_TOKEN}"; }; f'
79+ push github $C0_GH_PR_HEAD_REF
80+ rules :
81+ - if : $C0_UPDATE_SNAPSHOTS
0 commit comments