Puiblish on Pypi, not on test #9
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: Python-Wheels | |
on: | |
push: | |
branches: [ $default-branch, master ] | |
permissions: write-all | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
VTK_VERSION_MAJOR: 9 | |
VTK_VERSION_MINOR: 2 | |
VTK_VERSION_PATCH: 6 | |
jobs: | |
build_wheels: | |
name: Build Python wheels x86_64 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, windows-latest, macOS-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
# Used to host cibuildwheel | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Create setup.py | |
run: | | |
mv wrappers/python/wheels.github/* ./ | |
python set_version.py | |
python set_eigen_data.py | |
rm set_version.py set_eigen_data.py | |
shell: bash | |
- name: download pre-built VTK static library (non-Linux) | |
uses: suisei-cn/actions-download-file@v1.4.0 | |
with: | |
url: https://github.com/sanguinariojoe/vtk-builds/releases/download/VTK-${{env.VTK_VERSION_MAJOR}}.${{env.VTK_VERSION_MINOR}}.${{env.VTK_VERSION_PATCH}}-static/vtk-${{runner.os}}-x86_64.tar.gz | |
target: ${{github.workspace}}/ | |
if: runner.os != 'Linux' | |
- name: download pre-built VTK static library (Linux-x86_64) | |
uses: suisei-cn/actions-download-file@v1.4.0 | |
with: | |
url: https://github.com/sanguinariojoe/vtk-builds/releases/download/VTK-${{env.VTK_VERSION_MAJOR}}.${{env.VTK_VERSION_MINOR}}.${{env.VTK_VERSION_PATCH}}-static/vtk-manylinux2014_x86_64.tar.gz | |
target: ${{github.workspace}}/ | |
if: runner.os == 'Linux' | |
- name: download pre-built VTK static library (Linux-i686) | |
uses: suisei-cn/actions-download-file@v1.4.0 | |
with: | |
url: https://github.com/sanguinariojoe/vtk-builds/releases/download/VTK-${{env.VTK_VERSION_MAJOR}}.${{env.VTK_VERSION_MINOR}}.${{env.VTK_VERSION_PATCH}}-static/vtk-manylinux2014_i686.tar.gz | |
target: ${{github.workspace}}/ | |
if: runner.os == 'Linux' | |
- name: Create folders | |
run: | | |
mkdir -p ${{github.workspace}}/vtk | |
if: runner.os != 'Linux' | |
- name: Extract VTK tgz | |
run: | | |
tar -xvzf vtk-${{runner.os}}-x86_64.tar.gz -C vtk/ | |
if: runner.os != 'Linux' | |
- name: Build the source distribution | |
run: python setup.py sdist | |
if: runner.os == 'Linux' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
if: runner.os == 'Linux' | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.16.2 | |
with: | |
output-dir: dist | |
env: | |
# configure cibuildwheel to build native archs ('auto'), and some | |
# emulated ones | |
CIBW_ARCHS_LINUX: auto | |
# Skip 32-bit wheels builds as well as musllinux | |
CIBW_SKIP: "*-win32 *musllinux*" | |
CIBW_BEFORE_ALL_LINUX: > | |
echo "Considering vtk-manylinux2014_`uname -m`.tar.gz..." && | |
mkdir -p vtk && | |
tar -xvzf vtk-manylinux2014_`uname -m`.tar.gz -C vtk/ | |
- uses: actions/upload-artifact@v3 | |
id: build_wheels | |
with: | |
name: python-wheels-x86_64 | |
path: ./dist/* | |
build_aarch64: | |
name: Build Python wheels aarch64 | |
uses: FloatingArrayDesign/MoorDyn/.github/workflows/python-wheels-manylinux-arch.yml@master | |
with: | |
arch: "aarch64" | |
secrets: inherit | |
build_ppc64le: | |
name: Build Python wheels ppc64le | |
uses: FloatingArrayDesign/MoorDyn/.github/workflows/python-wheels-manylinux-arch.yml@master | |
with: | |
arch: "ppc64le" | |
secrets: inherit | |
build_s390x: | |
name: Build Python wheels s390x | |
uses: FloatingArrayDesign/MoorDyn/.github/workflows/python-wheels-manylinux-arch.yml@master | |
with: | |
arch: "s390x" | |
secrets: inherit | |
publish: | |
runs-on: ${{ matrix.os }} | |
needs: [build_wheels, build_aarch64, build_ppc64le, build_s390x] | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download x86_64 dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-wheels-x86_64 | |
path: dist/ | |
- name: Download aarch64 dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-wheels-aarch64 | |
path: dist/ | |
- name: Download ppc64le dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-wheels-ppc64le | |
path: dist/ | |
- name: Download s390x dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-wheels-s390x | |
path: dist/ | |
- name: Publish package to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
# password: ${{ secrets.MOORDYN_TESTPYPI_API }} | |
# repository-url: https://test.pypi.org/legacy/ | |
password: ${{ secrets.MOORDYN_PYPI_API }} | |
repository-url: https://upload.pypi.org/legacy/ | |
skip-existing: true |