-
Notifications
You must be signed in to change notification settings - Fork 2
116 lines (112 loc) · 4.79 KB
/
build_wheels.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
name: Build and Upload Wheels
on: [push]
permissions:
id-token: write # Grant the workflow permissions to use the id-token
jobs:
build-linux-wheels:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
architecture: [x86_64, i686, aarch64]
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Install QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Docker image
run: |
docker pull quay.io/pypa/manylinux2014_${{ matrix.architecture }}
- name: List available Python versions
run: |
docker run --rm quay.io/pypa/manylinux2014_${{ matrix.architecture }} /bin/bash -c "ls -al /opt/_internal"
- name: Build wheels
run: |
docker run --rm -v $GITHUB_WORKSPACE:/project quay.io/pypa/manylinux2014_${{ matrix.architecture }} /bin/bash -c "
echo 'Starting the Docker container' >> /project/build.log
yum install -y fftw-devel && \
echo 'FFTW installed' >> /project/build.log && \
mkdir -p /project/dist/${{ matrix.architecture }} && \
echo 'Created dist directory' >> /project/build.log && \
for PYBIN in /opt/_internal/cpython-${{ matrix.python-version }}*/bin; do
echo 'Checking directory' \$PYBIN >> /project/build.log
if [ -d \$PYBIN ]; then
echo 'Using Python binary from' \$PYBIN >> /project/build.log
\$PYBIN/python -m ensurepip >> /project/build.log 2>&1 && \
echo 'Ensured pip' >> /project/build.log && \
\$PYBIN/pip install -U pip setuptools wheel auditwheel pybind11 >> /project/build.log 2>&1 && \
echo 'Installed dependencies' >> /project/build.log && \
cd /project && \
echo 'Building wheel with Python binary from' \$PYBIN >> /project/build.log && \
\$PYBIN/python setup.py bdist_wheel >> /project/build.log 2>&1 && \
echo 'Built wheel' >> /project/build.log && \
\$PYBIN/auditwheel repair dist/*.whl --plat manylinux2014_${{ matrix.architecture }} -w /project/dist/${{ matrix.architecture }} >> /project/build.log 2>&1 && \
echo 'Repaired wheel' >> /project/build.log && \
rm -f dist/*linux_x86_64.whl && \
echo 'Removed non-compliant wheels' >> /project/build.log
else
echo 'Directory' \$PYBIN 'does not exist' >> /project/build.log
fi
done
echo 'Contents of /project/dist/${{ matrix.architecture }}:' >> /project/build.log
ls -al /project/dist/${{ matrix.architecture }} >> /project/build.log
"
- name: Output build logs
run: |
if [ -f $GITHUB_WORKSPACE/build.log ]; then cat $GITHUB_WORKSPACE/build.log; else echo "Build log not found"; fi
- name: Verify wheels
run: |
ls -al $GITHUB_WORKSPACE/dist/${{ matrix.architecture }}/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: dist/${{ matrix.architecture }}
password: ${{ secrets.PYPI_API_TOKEN }}
build-macos-wheels:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- name: Set up Python
run: |
brew install pyenv
pyenv install ${{ matrix.python-version }}
pyenv global ${{ matrix.python-version }}
echo "Python version set to $(python --version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel pybind11
brew install fftw
- name: Build wheels
env:
ARCHFLAGS: "-arch x86_64 -arch arm64"
MACOSX_DEPLOYMENT_TARGET: "11.0"
run: |
mkdir -p $GITHUB_WORKSPACE/dist
python setup.py bdist_wheel
- name: Verify wheel creation
run: |
ls -al $GITHUB_WORKSPACE/dist/
- name: Repair wheels
env:
ARCHFLAGS: "-arch x86_64 -arch arm64"
MACOSX_DEPLOYMENT_TARGET: "11.0"
run: |
pip install delocate
delocate-listdeps $GITHUB_WORKSPACE/dist/*.whl # lists library dependencies
delocate-wheel $GITHUB_WORKSPACE/dist/*.whl # copies library dependencies into the wheel
- name: Verify repaired wheels
run: |
ls -al $GITHUB_WORKSPACE/dist/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: dist
password: ${{ secrets.PYPI_API_TOKEN }}