-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from benjeffery/build-wheels-docker
Build wheels in docker
- Loading branch information
Showing
3 changed files
with
69 additions
and
22 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
name: CD | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
@@ -21,26 +22,30 @@ jobs: | |
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install build twine auditwheel validate-pyproject[all] | ||
- name: Check and install package | ||
python -m pip install --upgrade pip build validate-pyproject[all] | ||
python -m build --sdist | ||
- name: Upload sdist | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sdist | ||
path: dist | ||
- name: Build wheels | ||
run: | | ||
validate-pyproject pyproject.toml | ||
python -m build | ||
python -m auditwheel repair dist/*.whl | ||
python -m twine check --strict dist/* | ||
python -m pip install dist/*.whl | ||
docker run --rm -v `pwd`:/project -w /project quay.io/pypa/manylinux2014_x86_64 bash .github/workflows/docker/buildwheel.sh | ||
- name: Check vcztools CLI | ||
run: | | ||
pip install numpy "zarr>=2.17,<3" click pyranges pyparsing | ||
pip install vcztools --no-index --only-binary vcztools -f dist/wheelhouse | ||
vcztools --help | ||
# Make sure we don't have ``vcztools`` in the CWD | ||
cd tests | ||
python -m vcztools --help | ||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
name: linux-wheels | ||
path: dist/wheelhouse | ||
|
||
publish-to-pypi: | ||
if: github.repository_owner == 'sgkit-dev' && github.event_name == 'release' | ||
|
@@ -55,11 +60,14 @@ jobs: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Download all | ||
uses: actions/[email protected] | ||
- name: Move to dist | ||
run: | | ||
mkdir dist | ||
cp */*.{whl,gz} dist/. | ||
ls dist | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
|
||
publish-to-testpypi: | ||
|
@@ -76,11 +84,14 @@ jobs: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: true | ||
repository-url: https://test.pypi.org/legacy/ | ||
- name: Download all | ||
uses: actions/[email protected] | ||
- name: Move to dist | ||
run: | | ||
mkdir dist | ||
cp */*.{whl,gz} dist/. | ||
ls dist | ||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
verbose: true | ||
repository-url: https://test.pypi.org/legacy/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
DOCKER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
source "$DOCKER_DIR/shared.env" | ||
|
||
set -e -x | ||
|
||
ARCH=`uname -p` | ||
echo "arch=$ARCH" | ||
|
||
# We're running as root in the docker container so git commands issued by | ||
# setuptools_scm will fail without this: | ||
git config --global --add safe.directory /project | ||
# Fetch the full history as we'll be missing tags otherwise. | ||
git fetch --unshallow | ||
for V in "${PYTHON_VERSIONS[@]}"; do | ||
git reset --hard | ||
git clean -fd | ||
PYBIN=/opt/python/$V/bin | ||
rm -rf build/ # Avoid lib build by one Python is used by another | ||
$PYBIN/python -m venv env | ||
source env/bin/activate | ||
$PYBIN/python -m pip install --upgrade build | ||
SETUPTOOLS_SCM_DEBUG=1 $PYBIN/python -m build | ||
done | ||
|
||
cd dist | ||
for whl in *.whl; do | ||
auditwheel -v repair "$whl" | ||
rm "$whl" | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PYTHON_VERSIONS=( | ||
cp39-cp39 | ||
cp310-cp310 | ||
cp311-cp311 | ||
cp312-cp312 | ||
) |