-
Notifications
You must be signed in to change notification settings - Fork 20
107 lines (94 loc) · 2.88 KB
/
react-components-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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: React Components CI
on:
pull_request:
branches:
- "**"
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
should-run: ${{ steps.filter.outputs.should-run }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
should-run:
- '.github/**'
- 'react-components/**'
react-components-ci:
needs: changes
if: ${{ needs.changes.outputs.should-run == 'true' }}
runs-on: ubuntu-latest
environment: CI
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Cognite CICD Yarn
working-directory: react-components
run: |
echo "
npmScopes:
cognite:
npmAlwaysAuth: true
npmAuthToken: \"\${NPM_TOKEN}\"
npmRegistryServer: "https://registry.npmjs.org"
" >> .yarnrc.yml
env:
NPM_TOKEN: ${{ secrets.NPM_READONLY_TOKEN }}
- name: Install NPM dependencies
working-directory: react-components
run: yarn install --immutable
env:
NPM_TOKEN: ${{ secrets.NPM_READONLY_TOKEN }}
- name: Lint
working-directory: react-components
continue-on-error: false
run: yarn run lint
env:
NPM_TOKEN: ${{ secrets.NPM_READONLY_TOKEN }}
- name: Check types
working-directory: react-components
continue-on-error: false
run: yarn run tsc --noEmit
env:
NPM_TOKEN: ${{ secrets.NPM_READONLY_TOKEN }}
- name: Build components
working-directory: react-components
continue-on-error: false
run: yarn run build
env:
NPM_TOKEN: ${{ secrets.NPM_READONLY_TOKEN }}
- name: Build Storybook
working-directory: react-components
continue-on-error: false
run: yarn run build-storybook
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Unit tests
working-directory: react-components
continue-on-error: false
run: yarn run test
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Install playwright browsers
working-directory: react-components
continue-on-error: false
run: yarn playwright install chromium
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Visual regression tests
working-directory: react-components
continue-on-error: false
run: yarn run test:playwright
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: react-components/playwright-report/