-
Notifications
You must be signed in to change notification settings - Fork 6
227 lines (227 loc) · 8.47 KB
/
build.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
name: CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
# Platform environment to log into for the e2e tests.
PLATFORM_ENV: 'stg'
# Username used to log into the organization whose ID is stored in the ORG_ID variable
PLATFORM_USER_NAME: ${{ secrets.PLATFORM_USER_NAME }}
# Password used to log into the organization whose ID is stored in the ORG_ID variable
PLATFORM_USER_PASSWORD: ${{ secrets.PLATFORM_USER_PASSWORD }}
# API key to delete all the API keys created by the e2e tests
PLATFORM_API_KEY: ${{ secrets.PLATFORM_API_KEY }}
# ID of the organization to log into for the e2e tests
ORG_ID: ${{ secrets.ORG_ID }}
# Passphrase use to encode/decode cliConfig
E2E_TOKEN_PASSPHRASE: ${{ secrets.E2E_TOKEN_PASSPHRASE }}
jobs:
lint:
name: Lint
runs-on: 'ubuntu-20.04'
steps:
- name: Setup runner
if: ${{matrix.os == 'ubuntu-20.04'}}
# Ensure we can use as many file watcher as we want. see https://github.com/facebook/create-react-app/blob/master/docusaurus/docs/troubleshooting.md#npm-start-fail-due-to-watch-error
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Setup runner
if: ${{matrix.os == 'windows-latest'}}
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: Setup repo
run: npm ci
- name: Check linting
run: npm run lint
unit-tests:
name: Unit Tests
runs-on: ${{matrix.os}}
strategy:
fail-fast: true
matrix:
os: ['ubuntu-20.04', 'windows-latest']
steps:
- name: Setup runner
if: ${{matrix.os == 'ubuntu-20.04'}}
# Ensure we can use as many file watcher as we want. see https://github.com/facebook/create-react-app/blob/master/docusaurus/docs/troubleshooting.md#npm-start-fail-due-to-watch-error
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
- name: Setup runner
if: ${{matrix.os == 'windows-latest'}}
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- name: Setup repo
run: npm ci
- name: Build
run: npm run build
- name: Tests
run: npm run test
e2e-setup-login:
timeout-minutes: 15
name: End-to-end login
runs-on: 'ubuntu-20.04'
outputs:
cliConfigJson: ${{ steps.setup.outputs.cliConfigJson}}
env:
# ID of the test run to identify resources to teardown.
TEST_RUN_ID: 'id${{ matrix.os }}-${{ github.sha }}-${{ github.run_attempt }}g'
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- uses: ./.github/actions/e2e-login
id: setup
e2e-setup-verdaccio:
strategy:
matrix:
os: ['ubuntu-20.04', 'windows-latest']
name: End-to-end publish packages
runs-on: ${{matrix.os}}
steps:
- name: Setup runner
if: ${{matrix.os == 'windows-latest'}}
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
with:
# pulls all commits (needed for computing the next version)
fetch-depth: 0
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
cache: 'npm'
node-version-file: '.nvmrc'
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
if: ${{matrix.os == 'ubuntu-20.04'}}
with:
path: packages/cli-e2e/verdaccio
key: verdaccio-${{matrix.os}}-${{ github.sha }}-${{ github.run_attempt }}
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
if: ${{matrix.os == 'windows-latest'}}
with:
path: packages\cli-e2e\verdaccio
key: verdaccio-${{matrix.os}}-${{ github.sha }}-${{ github.run_attempt }}
- run: npm ci
- name: Build
run: npm run build
- name: Setup E2E tests
run: node -r ts-node/register/transpile-only packages/cli-e2e/setup/ci-verdaccio.ts
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3
if: cancelled() || failure() || success()
with:
name: ${{matrix.os}}-verdaccio-publish-artifacts
path: ./packages/cli-e2e/artifacts
e2e:
name: End-to-end tests
runs-on: ${{matrix.os}}
needs: [e2e-setup-login, e2e-setup-verdaccio]
strategy:
fail-fast: false
matrix:
os: ['ubuntu-20.04', 'windows-latest']
node: ['18', '20']
spec:
[
'angular.specs.ts',
'atomic.specs.ts',
'auth.specs.ci.ts',
'deploy.specs.ts',
'orgList.specs.ts',
'orgResources.specs.ts',
'react.specs.ts',
'vue.specs.ts',
]
# TODO: fix auth spec with windows
exclude:
- os: windows-latest
spec: auth.specs.ci.ts
env:
# ID of the test run to identify resources to teardown.
TEST_RUN_ID: 'id${{ matrix.os }}-${{ matrix.node }}-${{ github.sha }}-${{ github.run_attempt }}g'
COVEO_DISABLE_AUTOUPDATE: true
CLI_CONFIG_JSON: ${{needs.e2e-setup-login.outputs.cliConfigJson}}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
if: ${{matrix.os == 'ubuntu-20.04'}}
with:
path: packages/cli-e2e/verdaccio
key: verdaccio-${{matrix.os}}-${{ github.sha }}-${{ github.run_attempt }}
restore-keys: verdaccio-${{matrix.os}}-${{ github.sha }}
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
if: ${{matrix.os == 'windows-latest'}}
with:
path: packages\cli-e2e\verdaccio
key: verdaccio-${{matrix.os}}-${{ github.sha }}-${{ github.run_attempt }}
restore-keys: verdaccio-${{matrix.os}}-${{ github.sha }}
- uses: ./.github/actions/e2e-run
with:
os: ${{ matrix.os }}
node: ${{ matrix.node }}
spec: ${{ matrix.spec }}
cliConfigJson: ${{ env.CLI_CONFIG_JSON }}
npmRegistry: 'http://127.0.0.1:4873'
e2e-teardown:
timeout-minutes: 15
name: End-to-end teardown
if: ${{ always() }}
needs: [e2e, e2e-setup-login]
runs-on: ubuntu-20.04
env:
# ID of the test run to identify resources to teardown.
TEST_RUN_ID: '${{ github.sha }}-${{ github.run_attempt }}g'
CLI_CONFIG_JSON: ${{needs.e2e-setup-login.outputs.cliConfigJson}}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- uses: ./.github/actions/e2e-clean
with:
cliConfigJson: ${{ env.CLI_CONFIG_JSON }}
e2e-report:
name: End-to-end status reporter
if: ${{ always() }}
needs: e2e
runs-on: ubuntu-20.04
steps:
- name: Check e2e matrix status
if: ${{ needs.e2e.result != 'success' }}
run: exit 1
prerelease:
timeout-minutes: 15
name: Pre-release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
needs: [e2e-report, lint, unit-tests]
runs-on: ubuntu-20.04
environment: prerelease
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
with:
# pulls all commits (needed for computing the next version)
fetch-depth: 0
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Release
run: |
npm run nx:graph
npm run release:phase1
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
DEBUG: '*'
IS_PRERELEASE: 'true'