Build manylinux #223
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
name: Build | |
on: [push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build_wheels: | |
name: ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2019, ubuntu-20.04, macos-12] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
pip3 install wheel oldest-supported-numpy PyGLM cibuildwheel | |
- name: Build extension | |
if: matrix.os != 'ubuntu-20.04' | |
run: | | |
python3 setup.py build | |
python3 setup.py bdist_wheel --py-limited-api=cp34 | |
- name: Build extension | |
if: matrix.os == 'ubuntu-20.04' | |
run: | | |
python3 setup.py sdist | |
python3 -m cibuildwheel --output-dir dist | |
for old in dist/*.whl | |
do | |
# actually cp34 since I'm using Py_LIMITED_API=0x03040000 | |
new=$(echo $old | sed 's/-cp.*/-cp34-abi3-manylinux2014_x86_64.whl/g') | |
mv $old $new | |
done | |
env: | |
CIBW_BUILD: cp36-manylinux_x86_64 | |
- name: Install extension | |
shell: bash | |
run: | | |
pip3 install dist/*.whl | |
- name: Load collision meshes | |
uses: actions/cache/restore@v3 | |
id: collision-cache-restore | |
with: | |
path: collision_meshes | |
key: collision-cache | |
enableCrossOsArchive: true | |
- name: Download collision meshes | |
if: steps.collision-cache-restore.outputs.cache-hit != 'true' | |
uses: suisei-cn/[email protected] | |
with: | |
url: https://mtheall.com/~mtheall/collision_meshes.tar | |
- name: Extract collision meshes | |
if: steps.collision-cache-restore.outputs.cache-hit != 'true' | |
uses: a7ul/[email protected] | |
with: | |
command: x | |
files: collision_meshes.tar | |
- name: Save collision meshes | |
if: steps.collision-cache-restore.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v3 | |
with: | |
path: collision_meshes | |
key: collision-cache | |
enableCrossOsArchive: true | |
- name: Run unit tests | |
run: | | |
python3 python-mtheall/unit_test.py | |
- name: Run regression tests | |
run: | | |
python3 python-mtheall/regression_test.py | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist/* | |
publish_pypi: | |
name: Publish PyPI | |
runs-on: ubuntu-latest | |
needs: build_wheels | |
environment: | |
name: pypi | |
url: https://pypi.org/p/RocketSim | |
permissions: | |
id-token: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |