Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Adapt CI #36

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion plugin/.editorconfig → .editorconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[*]

indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
indent_size = 2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
labels:
- bug
assignees: ''

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
name: Feature request
about: Suggest a new feature for this project
title: "[NEW FEATURE REQUEST]"
labels: Feature
labels:
- feature
assignees: ''

---
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: pre-commit
on:
pull_request:
push:
branches: [master]
branches:
- main

jobs:
pre-commit:
Expand Down
105 changes: 66 additions & 39 deletions .github/workflows/datamodel.yaml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
name: Docker

on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

release:
types: ['prereleased', 'released']
types:
- published

jobs:
docker-tests:
name: Docker
runs-on: ubuntu-18.04

# Release the datamodel by attaching generated SQL files to the release and pushing it to Dockerhub
release-datamodel:

runs-on: ubuntu-latest

strategy:
matrix:
Expand Down Expand Up @@ -52,41 +44,28 @@ jobs:
run: docker exec qgep init_qgep.sh wait
timeout-minutes: 10

- name: "run tests on qgep_build (structure)"
run: |
docker start qgep
# Run tests that depend on data model. Tests that require demo data are ignored and run below in qgep_prod
docker exec -e PGSERVICE=qgep_build qgep pytest --ignore test/test_import.py --ignore test/test_swmm.py

- name: "run tests on qgep_prod (production)"
run: |
docker start qgep
docker exec -e PGSERVICE=qgep_prod qgep pytest

- name: "dockerhub login"
if: github.event_name != 'pull_request'
run: |
docker login --username "${{ secrets.DOCKERHUB_USERNAME }}" --password "${{ secrets.DOCKERHUB_PASSWORD }}"

- name: "push to dockerhub"
if: github.event_name != 'pull_request'
run: |
docker push opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }}

- name: "push to dockerhub (:tag)"
if: github.event_name != 'pull_request' && matrix.pgis == env.pgis_stable && github.ref != 'refs/heads/master'
if: matrix.pgis == env.pgis_stable && github.ref != 'refs/heads/master'
run: |
docker tag opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }} opengisch/qgep_datamodel:${GITHUB_REF##*/}
docker push opengisch/qgep_datamodel:${GITHUB_REF##*/}

- name: "push to dockerhub (:latest)"
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master'
run: |
docker tag opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }} opengisch/qgep_datamodel:latest
docker push opengisch/qgep_datamodel:latest

- name: "create dumps"
if: github.event_name != 'pull_request' && matrix.pgis == env.pgis_stable
if: matrix.pgis == env.pgis_stable
run: |
CI_TAG=${GITHUB_REF#refs/*/} .deploy/create-dumps.py
ls artifacts
Expand All @@ -96,7 +75,7 @@ jobs:
PGUSER: postgres

- uses: svenstaro/upload-release-action@v2
if: github.event_name == 'release' && matrix.pgis == env.pgis_stable
if: matrix.pgis == env.pgis_stable
with:
file: artifacts/*
file_glob: true
Expand All @@ -107,10 +86,58 @@ jobs:
run: |
docker logs qgep

# TMATE disabled for now as it hangs process, we should do this instead :
# https://github.com/marketplace/actions/debugging-with-tmate#manually-triggered-debug
# - name: Setup tmate session
# if: failure()
# uses: mxschmitt/action-tmate@v3
# with:
# limit-access-to-actor: true
# Release the plugin to the QGIS plugin repository and to github releases using qgis-plugin-ci
release-plugin:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Qt lrelease
run: |
sudo apt-get update
sudo apt-get install qtbase5-dev qttools5-dev-tools

- name: Install qgis-plugin-ci
run: pip3 install qgis-plugin-ci==2.7.*

- name: Compile translations
run: lrelease $(find ./plugin -type f -name "*.ts")

- name: Release plugin
run: |
qgis-plugin-ci -v release $(echo "${GITHUB_REF_NAME}" | cut -d+ -f1) \
--release-tag ${GITHUB_REF_NAME} \
# --transifex-token ${{ secrets.TX_TOKEN }} \ # this is done separately
--github-token ${{ secrets.GITHUB_TOKEN }} \
--osgeo-username ${{ secrets.OSGEO_USERNAME }} \
--osgeo-password ${{ secrets.OSGEO_PASSWORD }} \
--allow-uncommitted-changes

release-docs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Compile translations
run: lrelease $(find ./doc -type f -name "*.ts")

- name: build
working-directory: ./doc
run: |
make html
touch build/html/.nojekyll

- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: doc/build/html
59 changes: 59 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

jobs:
test-datamodel:

runs-on: ubuntu-latest

strategy:
matrix:
# postgres-postgis version, see available tags https://hub.docker.com/r/postgis/postgis/tags
pgis:
- 9.6-3.2
- 10-3.2
- 11-3.2
- 12-3.2
fail-fast: false

steps:
- uses: actions/checkout@v2

- name: "assert version is up to date"
run: |
LAST_VERSION=$(ls datamodel/delta | sort -r | sed '/^delta_/!d' | head -n 1 | cut -d_ -f2)
CUR_VERSION=$(cat datamodel/system/CURRENT_VERSION.txt)
[[ "${LAST_VERSION}" == "${CUR_VERSION}" ]] || (echo "Version mismatch ${LAST_VERSION} != ${CUR_VERSION}" && exit 1)

- name: "build dockerfile"
run: docker build -f datamodel/.docker/Dockerfile --build-arg POSTGIS_VERSION=${{ matrix.pgis }} --tag opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }} datamodel

- name: "initialize qgep container"
run: docker run -d -p 5432:5432 --name qgep opengisch/qgep_datamodel:${GITHUB_REF##*/}-${{ matrix.pgis }}

- name: "wait for qgep container"
run: docker exec qgep init_qgep.sh wait
timeout-minutes: 10

- name: "run tests on qgep_build (structure)"
run: |
docker start qgep
# Run tests that depend on data model. Tests that require demo data are ignored and run below in qgep_prod
docker exec -e PGSERVICE=qgep_build qgep pytest --ignore test/test_import.py --ignore test/test_swmm.py

- name: "run tests on qgep_prod (production)"
run: |
docker start qgep
docker exec -e PGSERVICE=qgep_prod qgep pytest

- name: "failure logs"
if: failure()
run: |
docker logs qgep
28 changes: 28 additions & 0 deletions .github/workflows/translations-pull.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
schedule:
- cron: "5 1 * * *"
workflow_dispatch:

jobs:
translations-pull:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Install Requirements
run: |
sudo apt-get install -y qttools5-dev-tools
# v1.6.5: 2023-02-16
curl -OL https://github.com/transifex/cli/releases/download/v1.6.5/tx-linux-amd64.tar.gz
tar -xvzf tx-linux-amd64.tar.gz

- name: Pull translations from transifex
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: .\tx pull --all --minimum-perc 50

- uses: EndBug/add-and-commit@v9
with:
message: Synchronize translations
author_name: Translation update
author_email: info@opengis.ch
38 changes: 38 additions & 0 deletions .github/workflows/translations-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
branches:
- main

jobs:
translations-push:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Requirements
run: |
sudo apt-get install -y qttools5-dev-tools
curl -OL https://github.com/transifex/cli/releases/download/v1.6.5/tx-linux-amd64.tar.gz
tar -xvzf tx-linux-amd64.tar.gz
pip3 install qgis-plugin-ci==2.7.*

- name: Extract strings (qgepplugin)
working-directory: ./plugin
run: |
pylupdate5 $(find ./qgepplugin -type f -name "*.py") -ts qgepplugin/i18n/qgep-plugin.ts

- name: Extract strings (project)
working-directory: ./project
run: |
docker run --init -v "$(pwd):/usr/src/" opengisch/qgis:3.28-jammy xvfb-run python3 /usr/src/scripts/create_ts_files.py

- name: Extract strings (docs)
working-directory: ./doc
run: |
make gettext

- name: Push Translations
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: ./tx push --source
1 change: 0 additions & 1 deletion plugin/.pre-commit-config.yaml → .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# files: '^.*\.py|.*\.tpl|.*\.sql|.*\.yaml|.*\.txt|.*\.md$'
exclude: '^.*\.xtf|.*\.xml|.*\.ili|qgepqwat2ili/bin.*$'

repos:
Expand Down
3 changes: 3 additions & 0 deletions .qgis-plugin-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugin_path: plugin/qgepplugin
github_organization_slug: teksi
project_slug: teksi_wastewater
Loading