Skip to content

Commit f0558b1

Browse files
committed
Test musl Linux GitHub Actions workflow jobs.
1 parent f33edee commit f0558b1

1 file changed

Lines changed: 33 additions & 197 deletions

File tree

.github/workflows/build-lint-test-cover-docs-upload.yml

Lines changed: 33 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- '**'
66
workflow_call: # If invoked by build-publish-sign-release workflow.
77
jobs:
8-
manylinux:
8+
musllinux: # Linting, testing, and docs omitted (would duplicate manylinux).
99
runs-on: ${{ matrix.os-arch.os }}
1010
strategy:
1111
matrix:
@@ -19,206 +19,42 @@ jobs:
1919
- {version: '3.12', abi: 'cp312'}
2020
- {version: '3.13', abi: 'cp313'}
2121
name: >
22-
Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }}
23-
for manylinux2014_${{ matrix.os-arch.suffix }}
22+
Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }}
23+
for musllinux_1_2_${{ matrix.os-arch.suffix }}
2424
env:
25-
WHEELNAME_PY: ${{ github.ref_name }}-${{ matrix.python.abi }}
26-
WHEELNAME_OS: abi3-manylinux_2_17_${{ matrix.os-arch.suffix }}.manylinux2014_${{ matrix.os-arch.suffix }}
25+
CIBW_BUILD_VERBOSITY: 1
26+
CIBW_ARCHS_LINUX: ${{ matrix.os-arch.suffix }}
27+
CIBW_BUILD: ${{ matrix.python.abi }}-musllinux_${{ matrix.os-arch.suffix }}
28+
CIBW_PROJECT_REQUIRES_PYTHON: ">=${{ matrix.python.version }}"
29+
CIBW_ENVIRONMENT: LIBSODIUM_MAKE_ARGS="-j$(nproc)"
30+
CIBW_BEFORE_ALL: >
31+
pip install .[build] -v
32+
CIBW_REPAIR_WHEEL_COMMAND: ""
33+
CIBW_TEST_EXTRAS: "lint,test,docs"
34+
CIBW_BEFORE_TEST: >
35+
cd {project} &&
36+
cp build/lib*/bcl/_sodium.py src/bcl/_sodium.py &&
37+
pip3 install pystache~=0.6 setuptools &&
38+
apk add wget &&
39+
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz &&
40+
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
41+
CIBW_TEST_COMMAND: >
42+
cd {project} &&
43+
python -m pylint bcl src/bcl/_sodium.tmpl src/bcl/_sodium_build.py --disable=duplicate-code &&
44+
python src/bcl/bcl.py -v &&
45+
python -m pytest &&
46+
cd docs &&
47+
sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../src/bcl/_sodium_build.py ** &&
48+
make html
49+
CIBW_DEBUG_TRACEBACK: True
2750
steps:
2851
- uses: actions/checkout@v5
29-
- name: Install Python.
30-
uses: actions/setup-python@v6
31-
with:
32-
python-version: ${{ matrix.python.version }}
33-
architecture: ${{ matrix.os-arch.arch }}
34-
- name: Download libsodium source tree archive.
35-
run: |
36-
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
37-
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
38-
- name: Install Python dependencies for build process.
39-
run: |
40-
pip install .[build]
41-
- name: Build wheel file.
42-
run: |
43-
mkdir tmpwheelhouse
44-
LIBSODIUM_MAKE_ARGS="-j$(nproc)" python -m build --wheel
45-
mv dist/bcl*.whl tmpwheelhouse
46-
mkdir wheelhouse
47-
mv tmpwheelhouse/bcl*.whl wheelhouse/
48-
cp build/lib*/bcl/_sodium.py src/bcl/_sodium.py
49-
- name: Test wheel installation.
50-
run: |
51-
pip install -f wheelhouse --no-index --force-reinstall --no-dependencies bcl
52-
- name: Lint and test module (and compiled libsodium shared library file).
53-
run: |
54-
pip install -U .[lint,test]
55-
python -m pylint bcl src/bcl/_sodium.tmpl src/bcl/_sodium_build.py \
56-
--disable=duplicate-code # Check against linting rules.
57-
python src/bcl/bcl.py -v # Run doctests.
58-
python -m pytest # Run tests.
59-
- name: Publish coverage results.
60-
run: |
61-
pip install -U .[coveralls]
62-
python -m coveralls --service=github # Submit to coveralls.
63-
if: matrix.python.version == '3.12'
64-
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
67-
- name: Test auto-generation of documentation.
68-
run: |
69-
pip install -U .[docs]
70-
cd docs
71-
sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../src/bcl/_sodium_build.py
72-
make html
73-
cd ..
74-
- name: Upload wheel file.
75-
run: |
76-
mkdir bcl-wheelhouse
77-
mv wheelhouse/bcl*.whl bcl-wheelhouse/bcl-${{ env.WHEELNAME_PY }}-${{ env.WHEELNAME_OS }}.whl
78-
- uses: actions/upload-artifact@v4
79-
with:
80-
name: bcl-${{ env.WHEELNAME_PY }}-${{ env.WHEELNAME_OS }}
81-
path: bcl-wheelhouse/
82-
macos:
83-
runs-on: ${{ matrix.os-arch.os }}
84-
strategy:
85-
matrix:
86-
include:
87-
- os-arch:
88-
os: 'macos-13'
89-
arch: '10_9_x86_64'
90-
suffix: '10.9 Intel'
91-
flags: 'CFLAGS="-mmacosx-version-min=10.9 -march=core2"'
92-
python: {version: '3.9', abi: 'cp39', url: '3.9.13/python-3.9.13-macosx10.9'}
93-
os-arch:
94-
- {os: 'macos-13', arch: '11_0_x86_64', suffix: '11 Intel', flags: ''}
95-
- {os: 'macos-15', arch: '11_0_arm64', suffix: '11 ARM', flags: 'CFLAGS="-arch arm64" ARCHFLAGS="-arch arm64"'}
96-
python:
97-
- {version: '3.9', abi: 'cp39', url: '3.9.13/python-3.9.13-macos11'}
98-
- {version: '3.10', abi: 'cp310', url: '3.10.11/python-3.10.11-macos11'}
99-
- {version: '3.11', abi: 'cp311', url: '3.11.9/python-3.11.9-macos11'}
100-
- {version: '3.12', abi: 'cp312', url: '3.12.10/python-3.12.10-macos11'}
101-
- {version: '3.13', abi: 'cp313', url: '3.13.7/python-3.13.7-macos11'}
102-
name: >
103-
Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }}
104-
for macOS ${{ matrix.os-arch.suffix }}
105-
env:
106-
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.abi }}-abi3-macosx_${{ matrix.os-arch.arch }}
107-
steps:
108-
- uses: actions/checkout@v5
109-
- name: Install Python.
110-
run: |
111-
curl "https://www.python.org/ftp/python/${{ matrix.python.url }}.pkg" -o python.pkg
112-
sudo installer -pkg python.pkg -target /
113-
/Library/Frameworks/Python.framework/Versions/${{ matrix.python.version }}/bin/python3 \
114-
-m pip install -U virtualenv
115-
/Library/Frameworks/Python.framework/Versions/${{ matrix.python.version }}/bin/python3 \
116-
-m virtualenv venv
117-
- name: Download libsodium source tree archive.
118-
run: |
119-
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz
120-
mv libsodium-1.0.18.tar.gz src/bcl/libsodium.tar.gz
121-
- name: Install Python dependencies for build process.
122-
run: |
123-
venv/bin/pip install -U pip .[build]
12452
- name: Build wheel file.
125-
run: |
126-
mkdir wheelhouse
127-
rm -f dist/*.*
128-
LIBSODIUM_MAKE_ARGS="-j$(sysctl -n hw.ncpu)" ${{ matrix.os-arch.flags }} \
129-
venv/bin/python -m build --wheel && mv dist/bcl*.whl wheelhouse
130-
cp build/lib*/bcl/_sodium.py src/bcl/_sodium.py
131-
- name: Test wheel installation.
132-
run: |
133-
venv/bin/pip install -f wheelhouse --no-index --force-reinstall --no-dependencies bcl
134-
- name: Lint and test module (and compiled libsodium shared library file).
135-
run: |
136-
venv/bin/pip install -U pip .[lint,test]
137-
venv/bin/python -m pylint bcl src/bcl/_sodium.tmpl src/bcl/_sodium_build.py \
138-
--disable=duplicate-code # Check against linting rules.
139-
venv/bin/python src/bcl/bcl.py -v # Run doctests.
140-
venv/bin/python -m pytest # Run tests.
141-
- name: Test auto-generation of documentation.
142-
run: |
143-
venv/bin/pip install -U .[docs]
144-
cd docs
145-
../venv/bin/sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../src/bcl/_sodium_build.py
146-
make html SPHINXBUILD='../venv/bin/sphinx-build'
147-
cd ..
148-
- name: Upload wheel file.
149-
run: |
150-
mkdir bcl-wheelhouse
151-
mv wheelhouse/bcl*.whl bcl-wheelhouse/${{ env.WHEELNAME }}.whl
152-
- uses: actions/upload-artifact@v4
53+
uses: pypa/cibuildwheel@v3.2.0
15354
with:
154-
name: ${{ env.WHEELNAME }}
155-
path: bcl-wheelhouse/
156-
windows:
157-
runs-on: windows-2025
158-
strategy:
159-
matrix:
160-
windows:
161-
- {version: 'win_amd64', arch: 'x64', arch-sodium: 'x64', arch-vs: 'amd64'}
162-
python:
163-
- {version: '3.9', abi: 'cp39'}
164-
- {version: '3.10', abi: 'cp310'}
165-
- {version: '3.11', abi: 'cp311'}
166-
- {version: '3.12', abi: 'cp312'}
167-
- {version: '3.13', abi: 'cp313'}
168-
name: Python ${{ matrix.python.version }} with ABI ${{ matrix.python.abi }} for Windows ${{ matrix.windows.arch }}
169-
env:
170-
WHEELNAME: bcl-${{ github.ref_name }}-${{ matrix.python.abi }}-abi3-${{ matrix.windows.version }}
171-
INCLUDE: C:\libsodium\include
172-
LIB: C:\libsodium\${{ matrix.windows.arch-sodium }}\Release\v142\dynamic\
173-
steps:
174-
- uses: actions/checkout@v5
175-
- name: Install Python.
176-
uses: actions/setup-python@v6
177-
with:
178-
python-version: ${{ matrix.python.version }}
179-
architecture: ${{ matrix.windows.arch }}
180-
- name: Download and extract libsodium dynamic library file.
181-
run: |
182-
wget -O C:\libsodium-1.0.18-msvc.zip https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-msvc.zip
183-
Expand-Archive C:\libsodium-1.0.18-msvc.zip -DestinationPath C:\
184-
shell: powershell
185-
- name: Install Python dependencies for build process.
186-
run: |
187-
pip install -U pip .[build]
188-
shell: bash
189-
- name: Build wheel file.
190-
run: |
191-
mkdir wheelhouse
192-
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -no_logo -arch=${{ matrix.windows.arch-vs }}
193-
python -m build --wheel
194-
mv dist/bcl*.whl wheelhouse
195-
cp build/lib*/bcl/_sodium.py src/bcl/_sodium.py
196-
shell: cmd
197-
- name: Test wheel installation.
198-
run: |
199-
pip install -f wheelhouse bcl --no-index --force-reinstall --no-dependencies
200-
shell: bash
201-
- name: Lint and test module (and compiled libsodium shared library file).
202-
run: |
203-
pip install -U pip .[lint,test]
204-
python -m pylint bcl src/bcl/_sodium.tmpl src/bcl/_sodium_build.py --disable=duplicate-code # Check against linting rules.
205-
python src/bcl/bcl.py -v # Run doctests.
206-
python -m pytest # Run tests.
207-
shell: bash
208-
- name: Test auto-generation of documentation.
209-
run: |
210-
pip install -U .[docs]
211-
cd docs
212-
sphinx-apidoc -f -E --templatedir=_templates -o _source .. ../src/bcl/_sodium_build.py
213-
make html
214-
cd ..
215-
shell: bash
55+
output-dir: dist
21656
- name: Upload wheel file.
217-
run: |
218-
mkdir bcl-wheelhouse
219-
move wheelhouse\bcl*.whl bcl-wheelhouse\${{ env.WHEELNAME }}.whl
220-
shell: cmd
221-
- uses: actions/upload-artifact@v4
57+
uses: actions/upload-artifact@v4
22258
with:
223-
name: ${{ env.WHEELNAME }}
224-
path: bcl-wheelhouse\
59+
name: bcl-${{ github.ref_name }}-${{ matrix.python.abi }}-musllinux_1_2_${{ matrix.os-arch.arch }}
60+
path: dist/*.whl

0 commit comments

Comments
 (0)