Skip to content

Commit fa96ce1

Browse files
author
renaud gaudin
committed
Updating release workflow for libzim7
- Include python 3.9 - Use Cython 0.29.22 - Fixed build filename Also make download-libzim task re-run friendly on both platforms
1 parent 119e99f commit fa96ce1

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ on:
66
- v*
77

88
env:
9-
LIBZIM_VERSION: 6.1.8
9+
LIBZIM_VERSION: 7.0.0
1010
LIBZIM_INCLUDE_PATH: include/zim
1111
TWINE_USERNAME: __token__
1212
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
13+
# TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }}
1314
# TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
1415

1516
jobs:
@@ -21,7 +22,7 @@ jobs:
2122
os: [ubuntu-latest, macos-latest]
2223
# TODO: expand this to cross-platform builds (see V2 approach below)
2324
# os: [ubuntu-latest, windows-latest, macos-latest]
24-
python-version: [3.6, 3.7, 3.8]
25+
python-version: [3.6, 3.7, 3.8, 3.9]
2526

2627
steps:
2728
- uses: actions/checkout@v2
@@ -55,7 +56,7 @@ jobs:
5556
rm $CERTIFICATE
5657
security set-key-partition-list -S "apple-tool:,apple:" -s -k mysecretpassword build.keychain
5758
security find-identity -v
58-
sudo sntp -sS time.apple.com -t 60
59+
sudo sntp -sS -t 60 time4.google.com || true
5960
xcrun altool --store-password-in-keychain-item "ALTOOL_PASSWORD" \
6061
-u "${{ secrets.APPLE_SIGNING_ALTOOL_USERNAME }}" \
6162
-p "${{ secrets.APPLE_SIGNING_ALTOOL_PASSWORD }}"
@@ -99,7 +100,7 @@ jobs:
99100
100101
- name: Build cython and sdist
101102
run: |
102-
pip install --upgrade "cython>=0.29.20,<3.0" setuptools pip wheel
103+
pip install --upgrade "cython>=0.29.22,<3.0" setuptools pip wheel
103104
python3 setup.py build_ext --rpath $RPATH
104105
if [[ "${{ matrix.python-version }}" == "3.6" ]]
105106
then
@@ -109,15 +110,15 @@ jobs:
109110
- name: add macOS libzim binary to source for wheel
110111
if: matrix.os == 'macos-latest'
111112
run: |
112-
install_name_tool -change libzim.${LIBZIM_VERSION:0:1}.dylib @loader_path/libzim.${LIBZIM_VERSION:0:1}.dylib $(find build -name "wrapper*.so")
113-
cp -p lib/libzim.${LIBZIM_VERSION:0:1}.dylib libzim
113+
install_name_tool -change libzim.${LIBZIM_VERSION:0:1}.dylib @loader_path/libzim.${LIBZIM_VERSION:0:1}.dylib $(find build -name "libzim.cpython*.so")
114+
cp -pv lib/libzim.${LIBZIM_VERSION:0:1}.dylib $(find build/lib* -type d)/
114115
115116
- name: sign macOS wrapper binary
116117
if: matrix.os == 'macos-latest'
117118
run: |
118119
echo "make sure libzim is signed and notarized"
119-
spctl -a -v -t install libzim/libzim.${LIBZIM_VERSION:0:1}.dylib
120-
wrapper=$(find build -name "wrapper*.so")
120+
spctl -a -v -t install lib/libzim.${LIBZIM_VERSION:0:1}.dylib
121+
wrapper=$(find build -name "libzim.cpython*.so")
121122
echo "sign the wrapper"
122123
codesign --force --sign "${{ secrets.APPLE_SIGNING_IDENTITY }}" ${wrapper} --deep --timestamp
123124
echo "create ZIP package for notarization request"
@@ -136,7 +137,7 @@ jobs:
136137
137138
- name: add Linux libzim binary to source for wheel
138139
if: matrix.os == 'ubuntu-latest'
139-
run: cp -p lib/libzim.so.${LIBZIM_VERSION:0:1} libzim
140+
run: cp -pv lib/libzim.so.${LIBZIM_VERSION:0:1} $(find build/lib* -type d)/
140141

141142
- name: build wheel
142143
run: python3 setup.py bdist_wheel --plat-name=$PLAFTORM_NAME

MANIFEST.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ include pyproject.toml
55
include setup.cfg
66
include requirements-dev.txt
77
include tasks.py
8-
9-
include libzim/libzim.7.dylib
10-
include libzim/libzim.so.7
8+
include lib/libzim.7.dylib
9+
include lib/libzim.so.7
1110
include libzim/*.cxx
1211
include libzim/*.h
1312
include libzim/*.py

tasks.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,33 @@ def download_libzim(c, version="7.0.0"):
4343

4444
with urllib.request.urlopen(url) as response, open(fname, "wb") as fh: # nosec
4545
fh.write(response.read())
46+
47+
# extract and remove archive
4648
c.run(f"tar -xvf {fname.name}")
4749
c.run(f"rm -vf {fname.name}")
4850

51+
# remove previous install from target directories
52+
c.run("find ./include -not -name 'README.md' -not -name 'include' | xargs rm -rf")
53+
c.run("find ./lib -not -name 'README.md' -not -name 'lib' | xargs rm -rf")
54+
55+
# move extracted bins and headers to expected places
4956
dname = fname.with_suffix("").stem
5057
c.run(f"mv -v {dname}/include/* ./include/")
51-
c.run(f"mv -v {dname}/lib/* ./lib/")
58+
if platform.system() == "Linux":
59+
c.run(f"mv -v {dname}/lib/x86_64-linux-gnu/* ./lib/")
60+
c.run(f"rmdir {dname}/lib/x86_64-linux-gnu")
61+
else:
62+
c.run(f"mv -v {dname}/lib/* ./lib/")
63+
# remove extracted folder (should be empty)
5264
c.run(f"rmdir {dname}/lib {dname}/include/ {dname}")
5365

66+
# add link for version-less dylib and link from root
5467
if platform.system() == "Darwin":
55-
c.run(f"ln -svf ./lib/libzim.{version[0]}.dylib ./")
68+
c.run(f"ln -svf ./lib/libzim.{version[0]}.dylib .")
69+
c.run(f"ln -svf ./libzim.{version[0]}.dylib lib/libzim.dylib")
5670
else:
57-
c.run(f"ln -svf ./lib/libzim.so.{version[0]} ./")
71+
c.run(f"ln -svf ./lib/libzim.so.{version[0]} .")
72+
c.run(f"ln -svf ./libzim.so.{version[0]} lib/libzim.so")
5873

5974

6075
@task

0 commit comments

Comments
 (0)