-
Notifications
You must be signed in to change notification settings - Fork 13
183 lines (161 loc) · 7.14 KB
/
packages.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Build Mergin Plugin Packages
on:
push:
workflow_dispatch:
inputs:
PYTHON_API_CLIENT_VER:
description: 'python-api-client version: either a tag, release, or a branch'
required: true
default: 'master'
type: string
GEODIFF_VER:
description: 'Geodiff version released on PyPI repository'
default: '2.0.4'
type: string
env:
# Assign the version provided by 'workflow_dispatch' if available; otherwise, use the default.
PYTHON_API_CLIENT_VER: ${{ inputs.PYTHON_API_CLIENT_VER != '' && inputs.PYTHON_API_CLIENT_VER || '0.9.3' }}
GEODIFF_VER: ${{ inputs.GEODIFF_VER != '' && inputs.GEODIFF_VER || '2.0.4' }}
PYTHON_VER: "38"
PLUGIN_NAME: Mergin
jobs:
build_linux_binary:
name: Extract geodiff binary linux
runs-on: ubuntu-latest
env:
PY_PLATFORM: "manylinux2014_x86_64"
steps:
- uses: actions/setup-python@v4
name: Install Python
- name: Download pygeodiff binaries
run: |
pip3 download --only-binary=:all: \
--no-deps --platform ${PY_PLATFORM} \
--python-version ${PYTHON_VER} \
--implementation cp \
--abi cp${PYTHON_VER} pygeodiff==${GEODIFF_VER}
unzip -o pygeodiff-$GEODIFF_VER-cp${PYTHON_VER}-cp${PYTHON_VER}-manylinux_2_17_x86_64.${PY_PLATFORM}.whl -d tmp || true
mkdir pygeodiff-binaries
cp tmp/pygeodiff/libpygeodiff-${GEODIFF_VER}-python.so ./pygeodiff-binaries/
- name: Patching pygeodiff binaries
run: |
# get exact name of the linked library (e.g. libsqlite3-d9e27dab.so.0.8.6)
SQLITE_LINE=$(ldd ./pygeodiff-binaries/libpygeodiff-${GEODIFF_VER}-python.so | grep libsqlite3)
SQLITE_LIB=$(echo ${SQLITE_LINE} | sed -E "s/.*(libsqlite3-[a-z0-9]+.so[\\.0-9]+).*/\\1/")
patchelf --replace-needed ${SQLITE_LIB} libsqlite3.so.0 ./pygeodiff-binaries/libpygeodiff-${GEODIFF_VER}-python.so
patchelf --remove-rpath ./pygeodiff-binaries/libpygeodiff-${GEODIFF_VER}-python.so
- uses: actions/upload-artifact@v3
with:
path: ./pygeodiff-binaries/*.so
build_windows_binaries:
name: Extract geodiff binary windows
runs-on: windows-latest
steps:
- uses: actions/setup-python@v4
name: Install Python
- name: Install deps
run: |
choco install unzip
- name: Download pygeodiff 32 binaries
run: |
pip3 download --only-binary=:all: --no-deps --platform "win32" --python-version $env:PYTHON_VER pygeodiff==$env:GEODIFF_VER
unzip -o pygeodiff-$env:GEODIFF_VER-cp$env:PYTHON_VER-cp$env:PYTHON_VER-win32.whl -d tmp32
mkdir pygeodiff-binaries
copy tmp32\pygeodiff\*.pyd pygeodiff-binaries\
- name: Download pygeodiff 64 binaries
run: |
pip3 download --only-binary=:all: --no-deps --platform "win_amd64" --python-version $env:PYTHON_VER pygeodiff==$env:GEODIFF_VER
unzip -o pygeodiff-$env:GEODIFF_VER-cp$env:PYTHON_VER-cp$env:PYTHON_VER-win_amd64.whl -d tmp64
copy tmp64\pygeodiff\*.pyd pygeodiff-binaries\
- uses: actions/upload-artifact@v3
with:
path: ./pygeodiff-binaries/*.pyd
build_macos_binary:
name: Extract geodiff binary macos
runs-on: macos-latest
env:
PY_PLATFORM: "macosx_10_9_x86_64"
steps:
- uses: actions/setup-python@v4
name: Install Python
- name: Install deps
run: |
brew install unzip
- name: Download pygeodiff binaries
run: |
pip3 download --only-binary=:all: --no-deps --platform ${PY_PLATFORM} --python-version ${PYTHON_VER} --implementation cp --abi cp${PYTHON_VER} pygeodiff==$GEODIFF_VER
unzip -o pygeodiff-$GEODIFF_VER-cp${PYTHON_VER}-cp${PYTHON_VER}-${PY_PLATFORM}.whl -d tmp
mkdir pygeodiff-binaries
cp tmp/pygeodiff/*.dylib ./pygeodiff-binaries/
- name: Patching pygeodiff binaries
run: |
install_name_tool -change @loader_path/.dylibs/libsqlite3.0.dylib @rpath/libsqlite3.dylib ./pygeodiff-binaries/libpygeodiff-$GEODIFF_VER-python.dylib
OTOOL_L=$(otool -L ./pygeodiff-binaries/libpygeodiff-$GEODIFF_VER-python.dylib)
if echo "${OTOOL_L}" | grep -q loader_path
then
echo "libpygeodiff-$GEODIFF_VER-python.dylib was not patched correctly, maybe sqlite version changed??"
exit 1
fi
- uses: actions/upload-artifact@v3
with:
path: ./pygeodiff-binaries/*.dylib
create_mergin_plugin_package:
needs: [build_windows_binaries, build_linux_binary, build_macos_binary]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: MerginMaps/python-api-client
ref: ${{ env.PYTHON_API_CLIENT_VER }}
path: python-api-client
- name: prepare py-client dependencies
run: |
cd python-api-client
python3 setup.py sdist bdist_wheel
mkdir -p mergin/deps
# without __init__.py the deps dir may get recognized as "namespace package" in python
# and it can break qgis plugin unloading mechanism - see #126
touch mergin/deps/__init__.py
pip3 wheel -r mergin_client.egg-info/requires.txt -w mergin/deps
# special care for pygeodiff
unzip mergin/deps/pygeodiff-*.whl -d mergin/deps
# remove unncesessary files
rm -rf mergin/deps/*.dist-info
rm -rf mergin/deps/*.data
rm -rf mergin/deps/pygeodiff.libs
rm -rf mergin/deps/pygeodiff-*.whl
- name: check geodiff version in sync with python-api-client
run: |
GEODIFF_VER_FROM_CLIENT="$(geodiff="$(cat python-api-client/mergin_client.egg-info/requires.txt | grep pygeodiff)";echo ${geodiff#pygeodiff==})"
if [ "$GEODIFF_VER" != "$GEODIFF_VER_FROM_CLIENT" ]; then
echo "geodiff version defined in python-api-client requires.txt $GEODIFF_VER_FROM_CLIENT does not equal $GEODIFF_VER from the workpackage file"
exit 1; # or just warning??
fi
- uses: actions/download-artifact@v3
with:
name: artifact
path: pygeodiff-binaries
- name: include pygeodiff deps
run: |
cp pygeodiff-binaries/* python-api-client/mergin/deps/pygeodiff
- uses: actions/checkout@v3
with:
path: qgis-mergin-plugin
- name: create package
run: |
cp -r python-api-client/mergin qgis-mergin-plugin/Mergin
rsync -av --exclude='test' --exclude='/__pycache__/' --exclude='*/__pycache__/' qgis-mergin-plugin/Mergin output
# from 1 June 2024, plugins are required to include LICENSE file
cp qgis-mergin-plugin/LICENSE.txt output/Mergin/LICENSE
(cd output && zip -r9 ../mergin.zip Mergin/)
- uses: actions/upload-artifact@v3
with:
name: Mergin
path: output/
- name: upload asset on tagged release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: mergin.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}