Skip to content

Conversation

@nilsnolde
Copy link

fixes #114

apt-get clean

# Upstream script to run plugin tests (only for tags & master)
RUN ([[ "$qgis_version" == "master" ]] && upstream_version="master" || { [[ "$qgis_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && UPSTREAM="final-${VERSION//./_}"; }) && \
Copy link
Author

@nilsnolde nilsnolde Jul 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh, I put this together very quickly and didn't really go through the entire logic that determines $qgis_version. currently it allows master as that's the qgis_version default in the Dockerfile and turns 3.44.1 into final-3_44_1 (upstream tag).

or maybe you'd rather like to port that script into this repo? probably makes more sense? it's not used upstream in any other code, but no idea what other workflows might depend on that script.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather move this logic in the workflow to determine a new variable qgis_branch which would be used as an arugment here.
also, in the current code it seems there is a mismatch between upstream_version and UPSTREAM

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, see the new commit 82662a3

@nilsnolde nilsnolde marked this pull request as draft July 25, 2025 12:26
@nilsnolde
Copy link
Author

urgh, will make it work locally first 😅

@wojtek19022
Copy link

Hi @nilsnolde, i'm also looking for accept on this PR, it'd help me so much in testing qgis plugins

Comment on lines 96 to 106
QGIS_REF="NA"
TEST_URL="refs/heads"
if ! [[ "$QGIS_VERSION" == "master" || ]]; then
QGIS_REF=master
elif [[ "$QGIS_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
QGIS_REF="final-${QGIS_VERSION//./_}"
TEST_URL="refs/tags"
fi
if ! wget -q --spider https://api.github.com/repos/qgis/QGIS/git/${TEST_URL}/${QGIS_REF}; then
echo "Invalid git ref '${QGIS_REF}' for version '${QGIS_VERSION}'"
exit 1
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as requested, the logic to get the git ref is now in in the workflow.

as you can see, this simply assumes that any QGIS_VERSION will map to final-x_y_z tags (or simply master), it doesn't care about ltr-x_y tags. I'm not entirely sure what QGIS_VERSION can be, maybe you have a better idea here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this shell code became a bit too big to be inlined. it's quite cumbersome to test changes locally. IMHO it'd be better to outsource this to a proper script and at least run shellcheck or so on the scripts, ideally even testing the image a bit (more) before pushing it. What do you think?

FROM ${os}:${release}
LABEL maintainer="OPENGIS.ch <info@opengis.ch>"

ARG os
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not used anymore after

ARG os
ARG release
ARG repo
ARG qgis_version=master
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to where it's used, for layer caching purposes

ARG qgis_ref

RUN /opt/check_version.sh ${qgis_version}
RUN /opt/qgis_test_setup.sh ${qgis_ref}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will download and install the necessary scripts from qgis_ref

This image can be used to set up a testing environment for plugins, e.g.

```
PLUGIN_DIR=<plugin_name> # e.g. PLUGIN_NAME=valhalla
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this with https://github.com/nilsnolde/valhalla-qgis-plugin, should work similarly for all plugins

@nilsnolde nilsnolde marked this pull request as ready for review August 7, 2025 14:39
@nilsnolde nilsnolde requested a review from 3nids August 7, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scripts like qgis_setup.sh are missing

3 participants