Skip to content

fix: clear obsolete sessions #896

fix: clear obsolete sessions

fix: clear obsolete sessions #896

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