-
Notifications
You must be signed in to change notification settings - Fork 512
82 lines (79 loc) · 3.6 KB
/
dsm-test.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
name: Test DSM
on:
pull_request:
paths:
- 'akeneo-design-system/**'
# Maybe we can launch unit & visual in parallel in separate jobs
jobs:
test:
name: Launch tests on the DSM
runs-on: ubuntu-latest
steps:
- name: checkout:master
uses: actions/checkout@v2
- name: Use Node.js 13
uses: actions/setup-node@v1
with:
node-version: 13.13
- name: Install Packages
run: cd akeneo-design-system && yarn install
- name: Launch lint checks
run: cd akeneo-design-system && yarn lint:check
- name: Launch unit tests
run: cd akeneo-design-system && yarn test:run
- name: Launch visual tests
run: cd akeneo-design-system && yarn test:visual:run
id: visual_test_execution
- uses: actions/upload-artifact@v2
if: failure()
with:
name: test-folder
path: akeneo-design-system/src
# Update visual by doing a pull request
- name: Update visual tests
if: failure() && steps.visual_test_execution.outcome == 'failure'
# Here we add a "|| true" to the find command to avoid it to fail for no reason.
run: cd akeneo-design-system && find . -name '*__image_snapshots__*' -exec rm -rf {} \; || true && yarn test:visual:run -u
- uses: mdecoleman/pr-branch-name@1.0.0
if: failure() && steps.visual_test_execution.outcome == 'failure'
id: extract_branch
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Push to a new branch and create pull request
if: failure() && steps.visual_test_execution.outcome == 'failure'
id: create_visual_pull_request
uses: peter-evans/create-pull-request@v3
with:
commit-message: Update visual tests for branch ${{ steps.extract_branch.outputs.branch }}
branch: ${{ steps.extract_branch.outputs.branch }}-visual-update
base: ${{ steps.extract_branch.outputs.branch }}
title: Update visual tests for branch ${{ steps.extract_branch.outputs.branch }}
body: This PR updates the visual tests for the changes in the branch ${{ steps.extract_branch.outputs.branch }}
assignees: ${{ github.actor }}
- name: Comment PR to notify that new visual are available
uses: thollander/actions-comment-pull-request@master
if: failure() && steps.visual_test_execution.outcome == 'failure'
with:
message: |
Your visual regression tests are not passing.
Here is a pull request to fix them: https://github.com/${{ github.repository }}/pull/${{ steps.create_visual_pull_request.outputs.pull-request-number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Deploy storybook to a staging folder
- name: Build staging env
run: cd akeneo-design-system && yarn run storybook:build
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3.7.0-6
with:
personal_token: ${{ secrets.DSM_EXTERNAL_TOKEN }}
publish_dir: ./akeneo-design-system/storybook-static
destination_dir: ${{ github.event.number }}
keep_files: true
external_repository: samirboulil/dsm # To change
- name: Comment PR to say that the staging is available
uses: thollander/actions-comment-pull-request@master
with:
# To change
message: |
A new version of the staging env has been deployed :tada:
Check it out here: https://samirboulil.github.io/dsm/${{ github.event.number }}/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}