-
Notifications
You must be signed in to change notification settings - Fork 23
155 lines (149 loc) · 4.64 KB
/
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: CI
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']
push:
branches:
- main
jobs:
typecheck:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: pnpm/action-setup@v3.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm typecheck
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: pnpm/action-setup@v3.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm run lint
test:
runs-on: ubuntu-22.04
needs: [lint, typecheck]
strategy:
matrix:
node: ['18', '20']
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: '0'
- uses: pnpm/action-setup@v3.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm run test:unit:coverage
- uses: codecov/codecov-action@v4.1.1
accessibility:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: '0'
- uses: pnpm/action-setup@v3.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 20
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- run: pnpm install
- run: pnpm run test:a11y
build:
strategy:
matrix:
node: ['18', '20']
runs-on: ubuntu-22.04
needs: [lint, typecheck]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: pnpm/action-setup@v3.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm run build
build-examples: # This will build all projects in the examples folder, it assures that all examples are working
strategy:
matrix:
node: ['20']
runs-on: ubuntu-22.04
needs: [lint, test]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: pnpm/action-setup@v3.0.0
- name: Use Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm build
- run: pnpm install
- run: pnpm run build:examples
chromatic-deployment:
runs-on: ubuntu-22.04
env:
DEPLOYMENT_NAME: 'storybook'
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Export custom variables
run: |
SAFE_GITHUB_HEAD_REF_SLUG_URL=$(echo $GITHUB_HEAD_REF_SLUG_URL-$DEPLOYMENT_NAME | rev | cut -c-37 | rev | sed 's/^-//g')
([[ $GITHUB_REF == 'refs/heads/main' ]] && echo "BRANCH_SLUG=main" || echo "BRANCH_SLUG=$SAFE_GITHUB_HEAD_REF_SLUG_URL") >> $GITHUB_ENV
- name: Start deployment
uses: bobheadxi/deployments@v1.5.0
id: deployment
with:
step: start
token: ${{ secrets.GH_TOKEN }}
env: ${{ env.BRANCH_SLUG }}
ref: ${{ github.head_ref }}
- uses: pnpm/action-setup@v3.0.0
- name: Install dependencies
run: pnpm install
- name: Publish to Chromatic
uses: chromaui/action@v11
id: chromatic
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: build:storybook:stats
onlyChanged: true
- name: Update deployment
uses: bobheadxi/deployments@v1.5.0
with:
step: finish
env: ${{ env.BRANCH_SLUG }}
token: ${{ secrets.GH_TOKEN }}
auto_inactive: true
# This will now be automatically handled by github with the auto_inactive
override: false
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ steps.chromatic.outputs.storybookUrl }}