Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped CI away from ubuntu 22.04 quirks #595

Merged
merged 8 commits into from
Jul 8, 2024
Merged
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
12 changes: 8 additions & 4 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ FROM qgis/qgis:${QGIS_TEST_VERSION}
MAINTAINER Matthias Kuhn <[email protected]>

RUN apt-get update \
&& apt-get install -y \
python3-pip \
&& apt-get install -y python3-pip \
&& rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /tmp/
RUN pip3 install --upgrade pip
RUN pip3 install -r /tmp/requirements.txt

# Upgrading `pip` fixes: "WARNING: Generating metadata for package libqfieldsync produced metadata for project name unknown. Fix your #egg=libqfieldsync fragments."
# However, in QGIS>=3.38, this command fail as `pip` is Debian installed and protected, hence we have `|| true`.
RUN pip3 install --upgrade pip || true

# images for QGIS<=3.34 uses much older `pip` that does not support `--break-system-packages`
RUN pip3 install -r /tmp/requirements.txt || pip3 install -r /tmp/requirements.txt --break-system-packages

ENV LANG=C.UTF-8

Expand Down
18 changes: 0 additions & 18 deletions .docker/docker-compose.travis.yml

This file was deleted.

File renamed without changes.
69 changes: 32 additions & 37 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,17 @@ on:
jobs:
code_check:
name: Code check
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install pipenv
run: pip install pipenv
- name: Check code formatting
run: |
pipenv install pre_commit
pipenv run python -m pre_commit run --all-files
- uses: actions/checkout@v3

- uses: actions/setup-python@v3

- uses: pre-commit/[email protected]

# Run unit tests
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
Expand All @@ -46,20 +39,22 @@ jobs:
QGIS_TEST_VERSION: ${{ matrix.qgis_version }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

- name: Test
run: |
docker-compose -f .docker/docker-compose.gh.yml run qgis /usr/src/.docker/run-docker-tests.sh
docker compose -f .docker/docker-compose.yml run qgis /usr/src/.docker/run-docker-tests.sh

test-22-04:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

- name: Test
run: |
wget -qO - https://qgis.org/downloads/qgis-2022.gpg.key | sudo gpg --no-default-keyring --keyring gnupg-ring:/etc/apt/trusted.gpg.d/qgis-archive.gpg --import
Expand All @@ -68,15 +63,19 @@ jobs:

sudo apt update
sudo apt install qgis
sudo pip3 install --upgrade pip
sudo pip3 install pytest nose2 mock

# Upgrading `pip` fixes: "WARNING: Generating metadata for package libqfieldsync produced metadata for project name unknown. Fix your #egg=libqfieldsync fragments."
pip3 install --upgrade pip

# Install dependencies, including `libqfieldsync`
pip3 install -r requirements.txt

xvfb-run pytest

release:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'release' }}
env:
OSGEO_USERNAME: mkuhn
OSGEO_PASSWORD: ${{ secrets.OSGEO_PASSWORD }}
Expand All @@ -85,20 +84,21 @@ jobs:
GITHUB_REF: ${{ github.ref }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: |
sudo apt update && sudo apt install qtbase5-dev qttools5-dev-tools
sudo pip install qgis-plugin-ci

- name: Package libqfieldsync
run: |
python3 -m pip install pip -U # https://github.com/pypa/setuptools/issues/3269
pip wheel $(grep -o -P '(https://.*.tar.gz)' requirements.txt)
mv libqfieldsync-*.whl qfieldsync/libqfieldsync.whl

- name: Release
if: ${{ github.event_name == 'release' }}
run: |
RELEASE_VERSION=${GITHUB_REF##*/}
RELEASE_TAG=${GITHUB_REF##*/}
Expand All @@ -110,54 +110,49 @@ jobs:
--osgeo-password ${OSGEO_PASSWORD} \
--asset-path qfieldsync/libqfieldsync.whl

- name: Package
if: ${{ github.event_name == 'pull_request' }}
run: |
qgis-plugin-ci package 0.1 \
--asset-path qfieldsync/libqfieldsync.whl

- uses: actions/upload-artifact@v3
with:
name: qfieldsync-plugin
path: qfieldsync.0.1.zip
package:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: ${{ github.event_name == 'workflow_dispatch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TX_TOKEN: ${{ secrets.TX_TOKEN }}
GITHUB_REF: ${{ github.ref }}
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive
ref: ${{ github.event.inputs.ref }}

- name: Install dependencies
run: |
sudo apt update && sudo apt install qtbase5-dev qttools5-dev-tools
sudo pip install qgis-plugin-ci

- name: Release
run: |
qgis-plugin-ci package ${{ github.event.inputs.ref }} --transifex-token ${TX_TOKEN}

- name: Upload release assets
uses: actions/upload-artifact@v2
with:
name: qfieldsync.${{ github.event.inputs.ref }}.zip
path: ./qfieldsync.${{ github.event.inputs.ref }}.zip

translations:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies
run: sudo pip install qgis-plugin-ci

- name: 🌍 Push translations
run: |
qgis-plugin-ci push-translation ${TX_TOKEN}
38 changes: 10 additions & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
repos:
# Fix end of files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args:
- '--fix=lf'

# Remove unused imports/variables
- repo: https://github.com/myint/autoflake
rev: v1.4
# Lint and format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.4
hooks:
- id: autoflake
args:
- "--in-place"
- "--remove-all-unused-imports"
- "--remove-unused-variables"
- "--exclude=__init__.py"

# Sort imports
- repo: https://github.com/pycqa/isort
rev: "5.12.0"
hooks:
- id: isort
args: ["--profile", "black"]
# Run the linter.
- id: ruff
args: [ --fix ]

# Black formatting
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black

# Lint files
- repo: https://github.com/pycqa/flake8
rev: "3.9.0"
hooks:
- id: flake8
# Run the formatter.
- id: ruff-format
2 changes: 0 additions & 2 deletions qfieldsync/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@

from __future__ import absolute_import

import os
import pathlib
import sys

import qgis.utils

src_dir = pathlib.Path(__file__).parent.resolve()

Expand Down
2 changes: 0 additions & 2 deletions qfieldsync/core/cloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def from_reply(reply: QNetworkReply) -> Optional[CloudException]:


class CloudNetworkAccessManager(QObject):

token_changed = pyqtSignal()
login_finished = pyqtSignal()
logout_success = pyqtSignal()
Expand Down Expand Up @@ -726,7 +725,6 @@ def __init__(self, reply: QNetworkReply):


class CloudProjectsCache(QObject):

projects_started = pyqtSignal()
projects_updated = pyqtSignal()
projects_error = pyqtSignal(str)
Expand Down
1 change: 0 additions & 1 deletion qfieldsync/core/cloud_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def __init__(
project: QgsProject,
export_dirname: str,
):

super(CloudConverter, self).__init__(parent=None)
self.project = project
self.__layers = list()
Expand Down
1 change: 0 additions & 1 deletion qfieldsync/core/cloud_transferrer.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def _on_logout_success(self) -> None:


class FileTransfer(QObject):

progress = pyqtSignal(int, int)
finished = pyqtSignal()

Expand Down
4 changes: 1 addition & 3 deletions qfieldsync/gui/cloud_transfer_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ def showEvent(self, event: QShowEvent) -> None:
else:
self.show_project_local_dir_selection()
else:
if (
self.network_manager.projects_cache.is_currently_open_project_cloud_local
):
if self.network_manager.projects_cache.is_currently_open_project_cloud_local:
reply = self.network_manager.projects_cache.refresh()
reply.finished.connect(lambda: self.show_project_compatibility_page())

Expand Down
5 changes: 3 additions & 2 deletions qfieldsync/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
***************************************************************************/
"""

# TODO check if this file should have any contents at all???
# import qgis libs so that ve set the correct sip api version
import pkgutil
import pkgutil # pylint: disable=W0611 # NOQA

import qgis # pylint: disable=W0611 # NOQA

import qfieldsync
import qfieldsync # pylint: disable=W0611 # NOQA
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
flake8==2.5.5
pep8-naming
flake8-respect-noqa
nose2
pytest
future
transifex-client
Expand Down
Loading