-
Notifications
You must be signed in to change notification settings - Fork 18
177 lines (149 loc) · 6.5 KB
/
robot-framework.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
name: Integration tests on Robot Framework
on:
pull_request:
branches-ignore:
- master
- l10n_main
- l10n_master
- l10n_new-theme
push:
branches-ignore:
- master
- l10n_main
- l10n_master
- l10n_new-theme
- deployment/docker-tag/**
env:
PGUSER: geokrety
PGPASSWORD: geokrety
PGDATABASE: geokrety
PGHOST: localhost
PGPORT: 5433
DOCKER_COMPOSE: docker compose -p gk -f docker-compose.local.yml --progress quiet
jobs:
robot-framework:
if: "${{ !contains(github.event.head_commit.message, 'skip translate') && !contains(github.event.head_commit.message, 'skip test-qa') }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set output
id: vars
run: |
echo "short_ref=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Configure Sentry
run: |
echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" > .env
echo "SENTRY_ENV=dev.githubaction" >> .env
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y git httping postgresql-client postgis libtap-parser-sourcehandler-pgtap-perl
- name: Pull/Start postgres
run: |
./website/db/get_huge_dump_files.sh
${DOCKER_COMPOSE} pull -q postgres
${DOCKER_COMPOSE} up -d --no-build postgres
timeout 60s bash -c "while ! pg_isready; do sleep 1; done" || { docker ps -a; ${DOCKER_COMPOSE} logs postgres; false; }
- name: Import SRTM data
run: |
# Prevent DNS issue with new GH Runner on Ubuntu 22.04
for i in $(seq 60); do
httping -sGc1 -o 200,302 https://srtm.geokrety.org/Eurasia/N52E021.hgt.zip && { echo OK; break; } || { sleep 1; }
done || exit 1
./website/db/tests-srtm-import.sh
psql -c "SELECT count(*) FROM public.srtm"
psql -c "SELECT iso_a2 FROM public.countries WHERE public.ST_Intersects(geom::public.geometry, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540'::public.geometry);"
psql -c "SELECT public.ST_Value(rast, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540'::public.geometry) As elevation FROM public.srtm WHERE public.ST_Intersects(rast, '0101000020E6100000F6285C8FC2F51C405C8FC2F528DC4540'::public.geometry);"
- name: Check for existing website-base image for current branch
if: "${{ !startsWith(github.ref, 'refs/tags/v') }}"
id: existing-image
run: |
if docker pull geokrety/website-base:${{ github.ref_name }}; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Override base image tag from branch name
if: "${{ !startsWith(github.ref, 'refs/tags/v') && steps.existing-image.outputs.exists == 'true' }}"
run: |
sed -i "s/^ARG BASE_TAG=.*$/ARG BASE_TAG=${{ github.ref_name }}/" Dockerfile
- name: Build images website
run: |
${DOCKER_COMPOSE} build website --build-arg GIT_COMMIT=${{ steps.vars.outputs.short_ref }}
- name: Start the whole stack
run: |
cat .env
${DOCKER_COMPOSE} --env-file .env up -d --no-build
- name: Check the stack has started
run: |
docker ps -a
sleep 5
for i in $(seq 60); do
httping -sGc1 -o 200,302 http://localhost:3001/health && { echo OK; break; } || { ${DOCKER_COMPOSE} logs website; ${DOCKER_COMPOSE} logs nginx; ${DOCKER_COMPOSE} ps; sleep 1; }
done || exit 1
${DOCKER_COMPOSE} exec -T website make test-health
- name: Run database tests
run: |
PGOPTIONS=--search_path=public,pgtap,geokrety pg_prove -ot website/db/tests/test*.sql
- name: Ensure available fonts on system for Robot Framework/Firefox
run: |
sudo apt-get install -y ttf-bitstream-vera fonts-urw-base35
- name: Install Robot Framework
run: |
pip3 install -r tests-qa/requirements.txt
cd tests-qa && make download_geckodriver && cd ..
- name: Run Robot Framework tests
env:
GEOKRETY_URL: http://localhost:3001/
GIT_BRANCH: ${{ steps.vars.outputs.short_ref }}
run: |
make test-qa-headless
- name: Get nginx logs
if: failure()
run: ${DOCKER_COMPOSE} logs nginx
- name: Get php logs
if: failure()
run: ${DOCKER_COMPOSE} logs website
- name: Get postgres logs
if: failure()
run: ${DOCKER_COMPOSE} logs postgres
- name: Get pictures-downloader logs
if: failure()
run: |
${DOCKER_COMPOSE} logs pictures-downloader
echo "---------- /tmp/headers ------------"
cat /tmp/headers || true
echo "---------- /tmp/body ------------"
cat /tmp/body || true
- name: Get pictures-uploader logs
if: failure()
run: ${DOCKER_COMPOSE} logs pictures-uploader
- name: Get svg-to-png logs
if: failure()
run: ${DOCKER_COMPOSE} logs svg-to-png
- name: Get minio logs
if: failure()
run: ${DOCKER_COMPOSE} logs minio
- name: Deploy
if: always()
uses: peaceiris/actions-gh-pages@v3
with:
# force_orphan: true ## see https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-keeping-existing-files-keep_files
keep_files: true
deploy_key: ${{ secrets.QA_TEST_DEPLOY_KEY }}
external_repository: geokrety/geokrety-website-qa
publish_branch: gh-pages
publish_dir: ./tests-qa/docs/${{ steps.vars.outputs.short_ref }}
destination_dir: ${{ steps.vars.outputs.short_ref }}
user_name: geokrety-bot
user_email: geokrety-bot@geokrety.org
commit_message: "docs: Update QA tests results"
- name: Show report URL
if: always()
run: |
echo https://geokrety.github.io/geokrety-website-qa/${{ steps.vars.outputs.short_ref }}/report.html
echo https://geokrety.github.io/geokrety-website-qa/${{ steps.vars.outputs.short_ref }}/visualReport.html
echo '### Robot Framework reports' >> $GITHUB_STEP_SUMMARY
echo '* [report](https://geokrety.github.io/geokrety-website-qa/${{ steps.vars.outputs.short_ref }}/report.html)' >> $GITHUB_STEP_SUMMARY
echo '* [visualReport](https://geokrety.github.io/geokrety-website-qa/${{ steps.vars.outputs.short_ref }}/visualReport.html)' >> $GITHUB_STEP_SUMMARY