-
Notifications
You must be signed in to change notification settings - Fork 16
131 lines (107 loc) · 4.11 KB
/
accessibility_test.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
name: Accessibility test
on: pull_request
jobs:
run-accessibility-test:
strategy:
matrix:
# Run against the current branch (represented by '', which will use the default ref when using the checkout action) and the base branch
branch: [ '', '${{ github.base_ref }}' ]
# Uses if/else expression evaluation workaround from https://github.com/actions/runner/issues/409#issuecomment-752775072
# 'matrix.branch == github.base_ref' is the condition, 'base' is the true value and 'current' is the false value
name: Accessibility test (${{ matrix.branch == github.base_ref && 'base' || 'current' }} branch)
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:16.1
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
env:
xpack.security.enabled: false
transport.host: localhost
network.host: 127.0.0.1
http.port: 9200
discovery.type: single-node
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- name: Install browser
uses: browser-actions/setup-chrome@v1
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '21.0.4+7'
distribution: 'temurin'
- name: Install npm
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v4
env:
cache-version: version1
with:
path: ./node_modules
key: dep-cache-${{ env.cache-version }}-${{ hashFiles('**/package-lock.json') }}
- if: ${{ steps.cache-dependencies.outputs.cache-hit != 'true' }}
name: Install dependencies if cache miss
run: npm ci
- name: Build
run: NODE_OPTIONS="--max-old-space-size=1610" npm run build.prod
# Run the services
- name: Install postgresql client
run: sudo apt install -y postgresql-client || true
- name: Prepare webservice
run: DB_DUMP="db_dump.sql" npm run webservice
- name: Install nginx
run: sudo apt install -y nginx || true
- name: Prepare nginx config
run: sed "s%REPLACEME%`pwd`%" .circleci/nginx.conf.tmpl > .circleci/nginx.conf
- name: Run nginx
run: sudo nginx -c `pwd`/.circleci/nginx.conf &
- name: Run webservice
run: java -jar dockstore-webservice.jar server test/web.yml 1>/dev/null &
- name: Wait for services
run: bash scripts/wait-for.sh
- name: Run accessibility test
run: |
if [[ "${{ matrix.branch }}" == "$GITHUB_BASE_REF" ]]; then
echo "Running accessibility test for base branch"
npm run accessibility-test -- -RB
else
echo "Running accessibility test for current branch"
npm run accessibility-test -- -R
fi
- name: Save accessibility results
uses: actions/upload-artifact@v4
with:
name: accessibility-results-${{ matrix.branch == github.base_ref && 'base' || 'current' }}
path: accessibility-results/
compare_accessibility_results:
needs: run-accessibility-test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Install npm
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Download accessibility results
uses: actions/download-artifact@v4
with:
# Download to this directory because this is the directory that the accessibility script looks at for the results
path: accessibility-results
pattern: accessibility-results-*
merge-multiple: true
- name: Compare accessibility results
run: npm run accessibility-test -- -A