forked from geonetwork/geonetwork-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
221 lines (187 loc) · 7.26 KB
/
checks.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
name: Checks
run-name: 🩺 Quality assurance checks on ${{ github.event_name == 'pull_request' && 'PR' || '🌱' }} ${{ github.event_name == 'pull_request' && github.event.number || github.ref_name }}
env:
NODE_VERSION: 18.16.1
TEST_HIDE_CONSOLE: true
# This workflow runs for Pull Requests which are not draft,
# as well as commits going to the default branch
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, ready_for_review]
# Only allow concurrent checks on the main branch to keep history
# on QA checks
concurrency:
group: checks-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
jobs:
format-lint-test:
if: github.event.pull_request.draft == false
name: Format check, lint, unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- run: npm ci
- run: npx nx format:check
- run: npx nx affected -t lint --parallel=3
- run: npx nx affected -t test --parallel=3 --configuration=ci --ci --codeCoverage --coverageReporters=lcov
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
allow-empty: true
# - name: Archive Code Coverage Results (on main)
# if: github.event_name != 'pull_request'
# uses: actions/upload-artifact@v2
# with:
# name: code-coverage-report
# path: ./coverage/**/coverage-summary.json
# if-no-files-found: error
#
# - name: Create Code Coverage Badge (on PR)
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
# uses: dkhunt27/nx-code-coverage@v1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# coverage-folder: ./coverage
# coverage-base-folder: ./coverage-base
# gist-token: ${{ secrets.COVERAGE_GIST_TOKEN }}
# gist-id: c759fcfd4e71c8853beedbe1785fc081
# color: green
# named-logo: jest
# no-coverage-ran: false
build-affected:
if: github.event.pull_request.draft == false
name: Attempt to build affected apps
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- run: npm ci
- run: npx nx affected -t build --parallel=3
affected-recap:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
name: Print affected libs and apps
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- name: Install dependencies
run: npm ci
- name: Compute affected projects
run: |
echo "AFFECTED_LIBS=$(npx nx print-affected --type=lib --select=projects | awk 'BEGIN {RS = ", "; ORS = ", "} \
{ print "`"$1"`" }')" >> $GITHUB_ENV
- name: Compute affected apps
run: |
echo "AFFECTED_APPS=$(npx nx print-affected --type=app --select=projects | awk 'BEGIN {RS = ", "; ORS = ", "} \
{ print "`"$1"`" }')" >> $GITHUB_ENV
- name: add PR comment
uses: thollander/actions-comment-pull-request@v2
with:
message: 'Affected libs: ${{ env.AFFECTED_LIBS }}
Affected apps: ${{ env.AFFECTED_APPS }}
- [ ] 🚀 Build and deploy storybook and demo on GitHub Pages
- [ ] 📦 Build and push affected docker images'
comment_tag: build-options
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
e2e-run:
name: E2E tests / ${{ matrix.app }} / GN v${{ matrix.gn_version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
gn_version: [4.2.2, 4.2.8, 4.4.0]
app: [datahub, metadata-editor]
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- name: Create pipeline docker image
working-directory: tools
run: docker build . -f pipelines/Dockerfile -t geonetwork/geonetwork-ui-tools-pipelines:latest
- name: Start up backend support services
env:
GEONETWORK_VERSION: ${{ matrix.gn_version }}
working-directory: support-services
run: docker compose up --quiet-pull init
- run: npm ci
- name: Run e2e tests for ${{ matrix.app }}
env:
APP: ${{ matrix.app }}
run: npx nx e2e "$APP-e2e"
- uses: actions/upload-artifact@v4
if: always()
id: upload-screenshots
with:
name: cypress-screenshots-app-${{ matrix.app }}-gn-${{ matrix.gn_version }}
path: |
apps/datahub-e2e/cypress/screenshots/**/*
apps/metadata-editor-e2e/cypress/screenshots/**/*
- uses: thollander/actions-comment-pull-request@v2
if: always() && github.event_name == 'pull_request' && steps.upload-screenshots.outputs.artifact-url
with:
message: '📷 Screenshots are [here](${{ steps.upload-screenshots.outputs.artifact-url }})!'
comment_tag: screenshots-url
pr_number: ${{ github.event.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-npm-package:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
name: Attempt to build the NPM package
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build NPM package
working-directory: package
run: node generate-package.js