-
Notifications
You must be signed in to change notification settings - Fork 46
129 lines (128 loc) · 5.33 KB
/
build_aarch64_linux_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
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Build and Publish Wheels (Linux aarch64)
on:
workflow_dispatch:
jobs:
build-linux-aarch64:
name: Linux Python aarch64 ${{ matrix.python-version }} - Build Wheels
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
include:
- python-version: "3.8"
PYTHON_VERSION_CODE: cp38-cp38
PYTHON_VERSION_NUMBER: "3.8"
PYTHON: /opt/python/cp38-cp38/bin/python3.8
PYTHON_PATH: /opt/python/cp38-cp38/bin/
PYTHON_INCLUDE: /opt/python/cp38-cp38/include/python3.8/
PYTHON_LIB: /opt/python/cp38-cp38/lib/python3.8
- python-version: "3.9"
PYTHON_VERSION_CODE: cp39-cp39
PYTHON_VERSION_NUMBER: "3.9"
PYTHON: /opt/python/cp39-cp39/bin/python3.9
PYTHON_PATH: /opt/python/cp39-cp39/bin/
PYTHON_INCLUDE: /opt/python/cp39-cp39/include/python3.9/
PYTHON_LIB: /opt/python/cp39-cp39/lib/python3.9
- python-version: "3.10"
PYTHON_VERSION_CODE: cp310-cp310
PYTHON_VERSION_NUMBER: "3.10"
PYTHON: /opt/python/cp310-cp310/bin/python3.10
PYTHON_PATH: /opt/python/cp310-cp310/bin/
PYTHON_INCLUDE: /opt/python/cp310-cp310/include/python3.10/
PYTHON_LIB: /opt/python/cp310-cp310/lib/python3.10
- python-version: "3.11"
PYTHON_VERSION_CODE: cp311-cp311
PYTHON_VERSION_NUMBER: "3.11"
PYTHON: /opt/python/cp311-cp311/bin/python3.11
PYTHON_PATH: /opt/python/cp311-cp311/bin/
PYTHON_INCLUDE: /opt/python/cp311-cp311/include/python3.11/
PYTHON_LIB: /opt/python/cp311-cp311/lib/python3.11
steps:
- name: Install QEMU deps
run: |
sudo apt-get update -q -y
sudo apt-get -qq install -y qemu qemu-user-static
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes
- name: Check out the repo
uses: actions/checkout@v2
- name: Set variables
run: |
VER=$(cat ./VERSION.txt)
echo "VERSION=$VER"
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Test environment
run: |
echo "VERSION=${{ env.VERSION }}"
echo "PYTHON_VERSION_CODE=${{ matrix.PYTHON_VERSION_CODE }}"
echo "PYTHON_VERSION_NUMBER=${{ matrix.PYTHON_VERSION_NUMBER }}"
- name: Run docker build
run: |
docker run --rm --tty -v $(pwd):/nimblephysics \
-e PYTHON=${{ matrix.PYTHON }} \
-e PYTHON_VERSION_CODE=${{ matrix.PYTHON_VERSION_CODE }} \
-e PYTHON_INCLUDE=${{ matrix.PYTHON_INCLUDE }} \
-e PYTHON_LIB=${{ matrix.PYTHON_LIB }} \
-e PYTHON_VERSION_NUMBER=${{ matrix.PYTHON_VERSION_NUMBER }} \
-e PYTHON_PATH=${{ matrix.PYTHON_PATH }} \
keenon/diffdart:base_aarch64 \
/bin/bash -c '\
cd /nimblephysics;\
VER=$(cat ./VERSION.txt);\
PATH="${PYTHON_PATH}:${PATH}";\
CPATH="${PYTHON_INCLUDE}";\
echo "VER=$VER";\
echo "PYTHON=$PYTHON";\
echo "PYTHON_VERSION_CODE=$PYTHON_VERSION_CODE";\
echo "PYTHON_INCLUDE=$PYTHON_INCLUDE";\
echo "PYTHON_LIB=$PYTHON_LIB";\
echo "PYTHON_VERSION_NUMBER=$PYTHON_VERSION_NUMBER";\
echo "PYTHON_PATH=$PYTHON_PATH";\
echo "PATH=$PATH";\
echo "CPATH=$CPATH";\
${PYTHON} -m pip install pytest wheel auditwheel==5.1.2 pybind11-stubgen==0.16.2 numpy torch;\
cd /;\
git clone https://github.com/pybind/pybind11.git;\
pushd pybind11;\
git checkout v2.11.1;\
mkdir build;\
pushd build;\
cmake -DPYTHON_LIBRARY=$PYTHON_LIB -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE -DPYTHON_EXECUTABLE=$PYTHON ..;\
make install -j4;\
cd /nimblephysics;\
${PYTHON} setup.py sdist bdist_wheel;\
${PYTHON} -m auditwheel repair dist/nimblephysics-${VER}-${PYTHON_VERSION_CODE}-linux_aarch64.whl;\
'
- name: Publish artifact
uses: actions/upload-artifact@v2
with:
name: nimblephysics-${{ env.VERSION }}-${{ matrix.PYTHON_VERSION_CODE }}-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
path: wheelhouse/nimblephysics-${{ env.VERSION }}-${{ matrix.PYTHON_VERSION_CODE }}-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build-linux-aarch64]
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: wheelhouse
- name: Display structure of downloaded files before flattening
run: ls -R
working-directory: wheelhouse
- name: Flatten files
run: |
mkdir wheelhouse2
find wheelhouse -type f -exec mv {} wheelhouse2 \;
rm -rf wheelhouse
mv wheelhouse2 wheelhouse
- name: Display structure of downloaded files after flattening
run: ls -R
working-directory: wheelhouse
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse/
skip_existing: true
verbose: true