-
Notifications
You must be signed in to change notification settings - Fork 45
117 lines (116 loc) · 5.06 KB
/
build_x86_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
name: Build and Publish Wheels (Linux x86_64)
on:
workflow_dispatch:
release:
types: [published]
jobs:
build-linux-x86_64:
name: Linux Python x86_64 ${{ matrix.python-version }} - Build Wheels
runs-on: ubuntu-latest
container: keenon/diffdart:base
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: 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: Install pytest, wheel, auditwheel, pybind11-stubgen, numpy and torch
run: ${{ matrix.PYTHON }} -m pip install pytest wheel auditwheel==5.1.2 pybind11-stubgen==0.16.2 numpy torch
- name: Install Pybind11 for this Python version
run: |
git clone https://github.com/pybind/pybind11.git
pushd pybind11
git checkout v2.11.1
mkdir build
pushd build
PATH="${{ matrix.PYTHON_PATH }}:${PATH}" CPATH="${{ matrix.PYTHON_INCLUDE }}" cmake ..
PATH="${{ matrix.PYTHON_PATH }}:${PATH}" CPATH="${{ matrix.PYTHON_INCLUDE }}" make install -j2
env:
PYTHON: ${{ matrix.PYTHON }}
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION_CODE }}
PYTHON_INCLUDE: ${{ matrix.PYTHON_INCLUDE }}
PYTHON_LIB: ${{ matrix.PYTHON_LIB }}
PYTHON_VERSION_NUMBER: ${{ matrix.PYTHON_VERSION_NUMBER }}
- name: Build wheel
run: |
PATH="${{ matrix.PYTHON_PATH }}:${PATH}" CPATH="${{ matrix.PYTHON_INCLUDE }}" ${{ matrix.PYTHON }} setup.py sdist bdist_wheel
PATH="${{ matrix.PYTHON_PATH }}:${PATH}" CPATH="${{ matrix.PYTHON_INCLUDE }}" ${{ matrix.PYTHON }} -m auditwheel repair dist/nimblephysics-${{ env.VERSION }}-${{ matrix.PYTHON_VERSION_CODE }}-linux_x86_64.whl
env:
PYTHON: ${{ matrix.PYTHON }}
PYTHON_VERSION: ${{ matrix.PYTHON_VERSION_CODE }}
PYTHON_INCLUDE: ${{ matrix.PYTHON_INCLUDE }}
PYTHON_LIB: ${{ matrix.PYTHON_LIB }}
PYTHON_VERSION_NUMBER: ${{ matrix.PYTHON_VERSION_NUMBER }}
- name: Publish artifact
uses: actions/upload-artifact@v2
with:
name: nimblephysics-${{ env.VERSION }}-${{ matrix.PYTHON_VERSION_CODE }}-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
path: wheelhouse/nimblephysics-${{ env.VERSION }}-${{ matrix.PYTHON_VERSION_CODE }}-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build-linux-x86_64]
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.8
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: wheelhouse/
skip_existing: true
verbose: true