-
Notifications
You must be signed in to change notification settings - Fork 1
233 lines (192 loc) · 6.55 KB
/
workflow.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
### Note: Dependabot does not have access to secrets and is only able
### to access a read-only version of the GITHUB-TOKEN:
### https://github.com/dependabot/dependabot-core/issues/3253
name: "Build, Test, and Publish"
on: [push, pull_request, workflow_dispatch]
jobs:
baw-client:
name: Build Baw Client
runs-on: ubuntu-latest
steps:
- name: Checkout Baw Client
uses: actions/checkout@v2
with:
repository: QutEcoacoustics/baw-client
ref: migration
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "12"
cache: "npm"
- name: Create environment
run: |
echo '{
"environments": {
"production": {
"apiRoot": "https://staging.ecosounds.org",
"siteRoot": "http://development.ecosounds.org:4200",
"siteDir": "/assets/old-client/",
"parentRoot": "http://development.ecosounds.org:4200",
"parentDir": "/",
"ga": { "trackingId": "" }
}
},
"values": {
"keys": { "googleMaps": "" },
"brand": {
"name": "<<brand name here>>",
"title": "<<brand name here>> | Acoustic Workbench"
},
"content": {
"research": {
"header_title": "Custom Menu",
"items": [
{
"innerText": "Example",
"url": "http://www.EXAMPLE.org/awebpage"
}
]
}
}
}
}' > ./buildConfig/environmentSettings.json
- name: Read environment
run: cat buildConfig/environmentSettings.json
- name: Install project dependencies
run: npm install
- name: Build
run: npm run build -- --production
- name: Publish build files
uses: actions/upload-artifact@v2
with:
path: bin/
name: baw-client
test:
name: Unit Tests (${{ matrix.os }} ${{ matrix.browsers }})
needs: baw-client
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
browsers:
- ChromeHeadless
- FirefoxHeadless
steps:
- name: Checkout Workbench Client
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
cache: "npm"
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: baw-client
- name: Copy baw-client to assets
run: mkdir src/assets/old-client && cp -r baw-client/baw-client/* src/assets/old-client
- name: Install project dependencies
run: npm ci --force
- name: Run test suite on ${{ matrix.browsers }}
run: npm run test:pipeline -- --browsers ${{ matrix.browsers }}
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Unit Test Results (OS ${{ matrix.os }})
path: TESTS-*.xml
- name: Lint project
run: npm run lint
# e2e:
# name: E2E Tests
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - name: Install Node.js
# uses: actions/setup-node@v1
# with:
# node-version: 12.x
# - name: NPM install
# run: npm ci
# # Webdriver downloads the latest driver version by default. If the version does not match the version of chrome
# # installed, it will crash during e2e tests. Best solution appears to be to download the version of the webdriver
# # which matches the CIs google chrome
# # https://github.com/angular/protractor/issues/5460
# - name: Ensure webdriver installs correct adapter for current chrome version
# run: npm run webdriver -- update --versions.chrome=$(google-chrome --version | cut -d ' ' -f 3)
# - name: Run e2e test suite
# run: npm run e2e -- --webdriver-update=false
ssr:
runs-on: ubuntu-latest
steps:
- name: Checkout Workbench Client
uses: actions/checkout@v2
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Build container
run: docker build -t qutecoacoustics/workbench-client . --build-arg GIT_COMMIT="a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0" --build-arg WORKBENCH_CLIENT_VERSION="70.1.1+test.a0a0a0a0"
- name: Run docker container
run: docker run -d -p 4000:4000 -v "$(pwd)/src/assets/environment.json:/environment.json" qutecoacoustics/workbench-client
- name: Run SSR tests
shell: pwsh
run: ./scripts/ssr-tests.ps1
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Workbench Client
uses: actions/checkout@v2
with:
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "16"
cache: "npm"
- name: Install project dependencies
run: npm ci --force
- name: Build the workbench client
run: npm run build
- name: Publish build files
uses: actions/upload-artifact@v2
with:
path: ./dist/workbench-client/
name: workbench-client
results:
name: "Publish Unit Tests Results"
runs-on: ubuntu-latest
needs: [test]
if: >
github.actor != 'dependabot[bot]' &&
github.actor != 'kodiakhq[bot]' &&
github.event_name == 'pull_request'
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
files: artifacts/**/TESTS-*.xml
test_changes_limit: 0
deduplicate_classes_by_file_name: true
publish:
name: "Publish Docker Container"
needs: [test, ssr, build]
if: >
github.actor != 'dependabot[bot]' &&
github.actor != 'kodiakhq[bot]' &&
(github.ref == 'refs/heads/master' || contains(github.ref, 'refs/tag'))
uses: ./.github/workflows/publish.yml
with:
release_tag: 'beta'
secrets: inherit