Skip to content

post review updates #615

post review updates

post review updates #615

Workflow file for this run

name: Run Mergin Plugin Tests
on:
push:
workflow_dispatch:
inputs:
PYTHON_API_CLIENT_VER:
description: 'python-api-client version: either a tag, release, or a branch'
required: true
default: 'master'
type: string
env:
# Assign the version provided by 'workflow_dispatch' if available; otherwise, use the default.
PYTHON_API_CLIENT_VER: ${{ inputs.PYTHON_API_CLIENT_VER != '' && inputs.PYTHON_API_CLIENT_VER || 'master' }}
PLUGIN_NAME: Mergin
TEST_FUNCTION: suite.test_all
DOCKER_IMAGE: qgis/qgis
concurrency:
group: ci-${{github.ref}}-autotests
cancel-in-progress: true
jobs:
run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
docker_tags: [release-3_22, release-3_34]
steps:
- name: Checkout client code
uses: actions/checkout@v3
with:
repository: MerginMaps/python-api-client
ref: ${{ env.PYTHON_API_CLIENT_VER }}
path: client
- name: Install python-api-client dependencies
run: |
pip3 install python-dateutil pytz wheel
cd client
mkdir -p mergin/deps
pip3 install pygeodiff --target=mergin/deps
python3 setup.py sdist bdist_wheel
# without __init__.py the deps dir may get recognized as "namespace package" in python
# and it can break qgis plugin unloading mechanism - see #126
touch mergin/deps/__init__.py
pip3 wheel -r mergin_client.egg-info/requires.txt -w mergin/deps
unzip -o mergin/deps/pygeodiff-*.whl -d mergin/deps
- name: Checkout plugin code
uses: actions/checkout@v3
with:
path: plugin
- name: Copy client files to the plugin directory
run: |
cp -r client/mergin plugin/Mergin
- name: Docker pull and create qgis-testing-environment
run: |
docker pull "$DOCKER_IMAGE":${{ matrix.docker_tags }}
docker run -d --name qgis-testing-environment -v "$GITHUB_WORKSPACE"/plugin:/tests_directory -e DISPLAY=:99 "$DOCKER_IMAGE":${{ matrix.docker_tags }}
# Wait for xvfb to finish starting
printf "Waiting for the docker...🐳..."
sleep 10
echo " done 🥩"
- name: Docker set up QGIS
run: |
docker exec qgis-testing-environment sh -c "qgis_setup.sh $PLUGIN_NAME"
docker exec qgis-testing-environment sh -c "rm -f /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
docker exec qgis-testing-environment sh -c "ln -s /tests_directory/$PLUGIN_NAME /root/.local/share/QGIS/QGIS3/profiles/default/python/plugins/$PLUGIN_NAME"
- name: Docker run plugin tests
run: |
docker exec qgis-testing-environment sh -c "cd /tests_directory/$PLUGIN_NAME/test && qgis_testrunner.sh $TEST_FUNCTION"