-
-
Notifications
You must be signed in to change notification settings - Fork 25
158 lines (135 loc) · 4.52 KB
/
continuous_integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
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}