-
Notifications
You must be signed in to change notification settings - Fork 10
84 lines (83 loc) · 2.38 KB
/
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
83
84
on:
workflow_call:
secrets:
CHROMATIC_PROJECT_TOKEN:
required: true
jobs:
setenv:
name: Set Environment Variables
runs-on: ubuntu-latest
outputs:
workspaces: ${{ steps.ls_public_workspaces.outputs.workspaces }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- id: ls_public_workspaces
run: echo "::set-output name=workspaces::$(yarn node ./workspaces.js --ls-public)"
shell: bash
lint:
name: "Lint Sources"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: yarn node ./bootstrap.js
shell: bash
- uses: actions/download-artifact@v3
with:
name: bundles_${{ github.sha }}
- run: yarn flow-typed-install
shell: bash
- run: yarn flow
shell: bash
- run: yarn lint
shell: bash
test:
name: "Test Project"
runs-on: ubuntu-latest
needs: setenv
strategy:
matrix:
path: ${{ fromJSON(needs.setenv.outputs.workspaces).*.path }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: yarn test --coverage --projects ${{ matrix.path }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: ${{ fromJSON(needs.setenv.outputs.workspaces)[strategy.job-index].name }}_coverage_${{ github.sha }}
path: |
${{ matrix.path }}/coverage
if-no-files-found: error
retention-days: 1
chromatic:
name: "Run Visual Tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: bundles_${{ github.sha }}
- uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
storybookBuildDir: storybook-static
onlyChanged: true
coverage:
name: "Report Coverage"
runs-on: ubuntu-latest
needs: [setenv, test]
strategy:
matrix:
flag: ${{ fromJSON(needs.setenv.outputs.workspaces).*.name }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ matrix.flag }}_coverage_${{ github.sha }}
- uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.flag }}