Merge pull request #607 from edouardbruelhart/master #900
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous integration | |
on: | |
push: | |
branches: | |
- master | |
- release-** | |
pull_request: | |
branches: | |
- '**' | |
release: | |
types: ['prereleased', 'released'] | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: Branch or SHA to checkout | |
required: true | |
default: 'master' | |
jobs: | |
code_check: | |
name: Code check | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- uses: pre-commit/[email protected] | |
# Run unit tests | |
test: | |
runs-on: ubuntu-24.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
qgis_version: [release-3_22, latest] | |
env: | |
QGIS_TEST_VERSION: ${{ matrix.qgis_version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Test | |
run: | | |
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@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 | |
sudo chmod a+r /etc/apt/trusted.gpg.d/qgis-archive.gpg | |
sudo add-apt-repository "deb https://qgis.org/ubuntu $(lsb_release -c -s) main" | |
sudo apt update | |
sudo apt install qgis | |
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-24.04 | |
if: ${{ github.event_name == 'release' }} | |
env: | |
OSGEO_USERNAME: mkuhn | |
OSGEO_PASSWORD: ${{ secrets.OSGEO_PASSWORD }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
GITHUB_REF: ${{ github.ref }} | |
steps: | |
- name: Checkout | |
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 --break-system-packages | |
- name: Package libqfieldsync | |
run: | | |
pip wheel $(grep -o -P '(https://.*.tar.gz)' requirements.txt) | |
mv libqfieldsync-*.whl qfieldsync/libqfieldsync.whl | |
- name: Release | |
run: | | |
RELEASE_VERSION=${GITHUB_REF##*/} | |
RELEASE_TAG=${GITHUB_REF##*/} | |
qgis-plugin-ci release ${RELEASE_VERSION} \ | |
--release-tag ${RELEASE_TAG} \ | |
--transifex-token ${TX_TOKEN} \ | |
--github-token ${GITHUB_TOKEN} \ | |
--osgeo-username ${OSGEO_USERNAME} \ | |
--osgeo-password ${OSGEO_PASSWORD} \ | |
--asset-path qfieldsync/libqfieldsync.whl | |
package: | |
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 }} | |
steps: | |
- name: Checkout | |
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 --break-system-packages | |
- 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-24.04 | |
env: | |
TX_TOKEN: ${{ secrets.TX_TOKEN }} | |
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install dependencies | |
run: sudo pip install qgis-plugin-ci --break-system-packages | |
- name: 🌍 Push translations | |
run: | | |
qgis-plugin-ci push-translation ${TX_TOKEN} |