-
Notifications
You must be signed in to change notification settings - Fork 17
237 lines (185 loc) · 5.88 KB
/
main.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: CI
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: '0 0 * * 0'
jobs:
yarn_install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Detect Yarn cache dir
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Restore Yarn packages
id: yarn-restore
uses: actions/cache/restore@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Restore node modules only if the SHA is perfect; to avoid possibility of corruption.
- name: Restore node_modules
id: node_modules-restore
uses: actions/cache/restore@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: Yarn install
if: steps.node_modules-restore.outputs.cache-hit != 'true'
run: yarn install
- name: Save Yarn packages
if: steps.node_modules-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Save node_modules
if: steps.node_modules-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ./node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
test_components:
runs-on: ubuntu-latest
needs: [yarn_install]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# The storybook runner is going to do some Git operations that rely on access to the main branch.
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: |
yarn workspaces foreach -v -t --exclude root --exclude @appland/appmap --exclude @appland/scanner run build
- name: Test
run: |
cd packages/components
yarn run lint
yarn run test
test_chromatic:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: [yarn_install]
env:
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: |
yarn workspaces foreach -v -t --exclude root --exclude @appland/appmap --exclude @appland/scanner run build
- name: Publish to Chromatic
uses: chromaui/action@latest
with:
workingDir: packages/components
test_cli:
runs-on: ubuntu-latest
needs: [yarn_install]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: yarn run build
- name: Test
run: |
cd packages/cli
yarn run lint
yarn run test
test_scanner:
runs-on: ubuntu-latest
needs: [yarn_install]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: |
yarn workspaces foreach -v -t --exclude root --exclude @appland/appmap --exclude @appland/components run build
- name: Test
run: |
cd packages/scanner
yarn run lint
yarn run test
test_native:
runs-on: ubuntu-latest
needs: [yarn_install]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Setup Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 3.1
- name: Build
run: yarn run build
- name: Test
run: |
cd packages/cli
yarn test:binary
test_the_rest:
runs-on: ubuntu-latest
needs: [yarn_install]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Build
run: |
yarn workspaces foreach -v -t --exclude root --exclude @appland/appmap --exclude @appland/components --exclude @appland/scanner run build
- name: Test
run: |
yarn workspaces foreach -v -t --exclude root --exclude @appland/appmap --exclude @appland/components --exclude @appland/scanner run lint
yarn workspaces foreach -v -t --exclude root --exclude @appland/appmap --exclude @appland/components --exclude @appland/scanner run test
release:
if: github.ref == 'refs/heads/main'
needs:
- test_cli
- test_components
- test_scanner
- test_native
- test_the_rest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.YARN_NPM_AUTH_TOKEN }}
CHROMATIC_PROJECT_TOKEN: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
GIT_AUTHOR_NAME: appland-release
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: appland-release
GIT_COMMITTER_EMAIL: [email protected]
run: |
yarn
yarn build
yarn semantic-release
yarn chromatic --auto-accept-changes