-
Notifications
You must be signed in to change notification settings - Fork 4
179 lines (163 loc) · 6.41 KB
/
testrunner.yaml
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
name: Testrunner
on:
push:
branches:
- main
pull_request:
schedule:
# XXX GHA unfortunately does not support randomize, so https://xkcd.com/221/
- cron: "22 4 * * *"
repository_dispatch: # triggered by ZeitOnline/zeit.newsimport
types: [test-app]
env:
project: vivi
build_url: "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
team_content_alerts: C06JB4PMALW
concurrency: test_branch_${{github.ref_name}}
jobs:
test:
runs-on: zon-ubuntu-general-dind
permissions:
contents: read
checks: write
id-token: write
steps:
- uses: actions/[email protected]
- name: determine deployment branch
run: |
if [[ "${{github.ref_name}}" = "main" ]]; then
branch="main"
else
branch=$(echo -e "${{github.event.pull_request.body}}" | \
sed -ne '/DEPLOYMENT_BRANCH=/s/DEPLOYMENT_BRANCH=//p' | \
tr --delete ' \r\n')
if [[ -z "$branch" ]]; then
branch=main
fi
fi
echo "DEPLOYMENT_BRANCH=$branch" >> $GITHUB_ENV
- name: checkout deployment
uses: actions/[email protected]
with:
repository: ZeitOnline/vivi-deployment
ref: ${{env.DEPLOYMENT_BRANCH}}
path: deployment
# Has been added manually (both the key in vivi-deployment and
# the GHA secret in vivi)
ssh-key: ${{secrets.DEPLOY_KEY_DEPLOYMENT}}
- uses: ZeitOnline/[email protected]
with:
project_name: ${{env.project}}
environment: staging
gar_docker_auth: true # for docker pull dav-server
vault_export_token: true
- name: checkout vivi
run: |
mkdir -p deployment/work/source
ln -s $PWD deployment/work/source/vivi
# Keys have been added manually (both the key in the target repo and
# the GHA+Dependabot secret in vivi and vivi-deployment)
- name: checkout zeit.jabber
uses: actions/[email protected]
with:
repository: ZeitOnline/zeit.jabber
path: deployment/work/source/zeit.jabber
ssh-key: ${{secrets.DEPLOY_KEY_JABBER}}
- name: checkout zeit.ldap
uses: actions/[email protected]
with:
repository: ZeitOnline/zeit.ldap
path: deployment/work/source/zeit.ldap
ssh-key: ${{secrets.DEPLOY_KEY_LDAP}}
- name: checkout zeit.newsimport
uses: actions/[email protected]
with:
repository: ZeitOnline/zeit.newsimport
path: deployment/work/source/zeit.newsimport
ssh-key: ${{secrets.DEPLOY_KEY_NEWSIMPORT}}
- uses: actions/[email protected]
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
deployment/components/source/*.txt
- uses: actions/[email protected] # for jshint
with:
node-version: "20"
- name: setup apt
# firefox dependencies see https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/registry/nativeDeps.ts
# gcc for e.g. `pygraphviz`
# libxml/xslt will be superfluous after ZO-859
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get -y install --no-install-recommends \
libasound2 libatk1.0-0 libcairo-gobject2 libcairo2 libdbus-1-3 libdbus-glib-1-2 libfontconfig1 libfreetype6 libgdk-pixbuf-2.0-0 libglib2.0-0 libgtk-3-0 libpango-1.0-0 libpangocairo-1.0-0 libx11-6 libx11-xcb1 libxcb-shm0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxtst6 \
build-essential graphviz-dev \
libxml2 libxslt1.1 \
pandoc
- uses: browser-actions/[email protected]
- name: setup geckodriver
run: |
curl -fsSL https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz \
| tar -xzv geckodriver && sudo mv geckodriver /usr/local/bin/geckodriver
- name: ./batou deploy local
run: |
cd deployment
./batou deploy gha
- name: display log output
if: failure()
run: |
for i in deployment/work/supervisor/var/log/*.log; do
echo $i
cat $i
done
- name: bin/test
run: |
# `pendulum` requires local timezone configuration
export TZ="Europe/Berlin"
if [[ "${{github.event_name}}" = "schedule" ]]; then
not_selenium='not selenium'
else
not_selenium='not selenium and not integration'
fi
set +e
deployment/bin/test -v -n 6 -m "$not_selenium" -r a \
--junitxml=report.xml --cov=. --cov-report=
result=$?
deployment/bin/test -v -n 4 -m 'selenium' --reruns=3 -r aR \
--junitxml=report_selenium.xml --cov=. \
--cov-append --cov-report=html
selenium=$?
if [[ "$result" = "0" ]]; then
result=$selenium
fi
exit $result
- name: Publish test result
uses: enricomi/[email protected]
if: always()
with:
comment_mode: "off"
files: "deployment/work/source/report*.xml"
- name: Publish coverage
uses: actions/[email protected]
id: coverage
with:
name: coverage-${{env.project}}
path: deployment/work/source/coverage-report
if-no-files-found: ignore
- name: Annotate coverage
uses: louisbrunner/[email protected]
with:
token: ${{secrets.GITHUB_TOKEN}} # unfortunately required
name: Coverage Report
conclusion: success
output: |
{"summary": "[Download](${{env.build_url}}/artifacts/${{steps.coverage.outputs.artifact-id}})"}
- uses: slackapi/[email protected]
if: failure() && github.ref_name == 'main' && github.event_name != 'schedule'
with:
channel-id: "${{env.team_content_alerts}}"
slack-message: ":small_red_triangle_down: <${{env.build_url}}|${{env.project}}> tests failed"
env:
SLACK_BOT_TOKEN: ${{secrets.SLACK_BOT_TOKEN}}