diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..451b698 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: pip + directory: "/" + schedule: + interval: monthly + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/plugin-package.yml b/.github/workflows/plugin-package.yml new file mode 100644 index 0000000..f53c3e1 --- /dev/null +++ b/.github/workflows/plugin-package.yml @@ -0,0 +1,57 @@ +name: 🔌 Plugin | Package and release + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + + +jobs: + plugin-package: + name: Packages and releases plugin + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install Qt lrelease + run: | + sudo apt-get update + sudo apt-get install qtbase5-dev qttools5-dev-tools + + - name: Install qgis-plugin-ci + run: pip install qgis-plugin-ci>=2.8.6 + + - name: 🌍 Push translations + if: ${{ github.event_name == 'push' }} + run: qgis-plugin-ci push-translation ${{ secrets.TX_TOKEN }} + + - name: Package PyPI Packages + run: ./plugin/scripts/package-pip-packages.sh + + - name: Package + run: | + VERSION=0.0.0 + qgis-plugin-ci -v package ${VERSION} \ + --allow-uncommitted-changes \ + --asset-path plugin/pg_service_parser_dev/libs \ + --transifex-token "${{ secrets.TX_TOKEN }}" + + - uses: actions/upload-artifact@v4 + with: + name: pg_service_parser_dev + path: plugin/pg_service_parser.0.0.0.zip + if-no-files-found: error diff --git a/.github/workflows/plugin-test.yml b/.github/workflows/plugin-test.yml new file mode 100644 index 0000000..13617a1 --- /dev/null +++ b/.github/workflows/plugin-test.yml @@ -0,0 +1,66 @@ +name: 🪲 Plugin | Tests + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - main + paths: + - datamodel/** + - plugin/** + - '.github/workflows/plugin-test.yml' + pull_request: + branches: + - main + paths: + - datamodel/** + - plugin/** + - '.github/workflows/plugin-test.yml' + workflow_dispatch: + + +jobs: + plugin-tests: + name: Run unit tests on plugin + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + qgis_version: [3.28-jammy, latest] + env: + QGIS_TEST_VERSION: ${{ matrix.qgis_version }} + COMPOSE_PROFILES: qgis + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Package PyPI Packages + run: sudo ./plugin/scripts/package-pip-packages.sh + + - name: Download Interlis libs + run: sudo ./plugin/scripts/download-interlis-libs.sh + + - name: Docker build + run: docker compose up -d --build + + - name: Test on QGIS + run: docker-compose run qgis /usr/src/plugin/.docker/run-docker-tests.sh + + - name: Test command line import orgs + run: docker-compose run qgis sh -c 'xvfb-run /usr/src/plugin/tww_cmd.py interlis_import --xtf_file /usr/src/plugin/teksi_wastewater/tests/data/minimal-dataset-organisation-arbon-only.xtf --pghost db --pgdatabase tww --pguser postgres --pgpass postgres --pgport 5432' + + - name: Test command line import minimal sia405 + run: docker-compose run qgis sh -c 'xvfb-run /usr/src/plugin/tww_cmd.py interlis_import --xtf_file /usr/src/plugin/teksi_wastewater/tests/data/minimal-dataset-SIA405-ABWASSER.xtf --pghost db --pgdatabase tww --pguser postgres --pgpass postgres --pgport 5432' + + - name: Test command line minimal export + run: docker-compose run qgis sh -c 'xvfb-run /usr/src/plugin/tww_cmd.py interlis_export --xtf_file "output.xtf" --pghost db --pgdatabase tww --pguser postgres --pgpass postgres --pgport 5432' + + - name: docker logs + #if: failure() + run: docker compose logs db diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..110bd02 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +pg_service_parser/libs \ No newline at end of file diff --git a/.qgis-plugin-ci b/.qgis-plugin-ci new file mode 100644 index 0000000..b7055dc --- /dev/null +++ b/.qgis-plugin-ci @@ -0,0 +1,9 @@ +plugin_path: pg_service_parser +github_organization_slug: opengisch +project_slug: qgis-pg-service-parser-plugin + +transifex_coordinator: geoninja +transifex_resource: swiss_locator +translation_languages: + - fr + - de \ No newline at end of file diff --git a/scripts/package-pip-packages.sh b/scripts/package-pip-packages.sh new file mode 100755 index 0000000..ae54f5a --- /dev/null +++ b/scripts/package-pip-packages.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +LIBS_DIR="pg_service_parser/libs" + +echo download and unpack pgserviceparser +#create temp folder +mkdir -p temp +#download the wheel +pip download -v pgserviceparser --only-binary :all: -d temp/ +#unpack all the wheels found (means including dependencies) +unzip -o "temp/*.whl" -d $LIBS_DIR +#remove temp folder +rm -r temp +#set write rights to group (because qgis-plugin-ci needs it) +chmod -R g+w $LIBS_DIR + +#create the __init__.py in libs folder +cd $LIBS_DIR +touch __init__.py +chmod g+w __init__.py