Skip to content

Publish dartpy

Publish dartpy #703

name: Publish dartpy
on:
push:
branches:
- "**"
paths-ignore:
- ".github/workflows/cache_*.yml"
- "docker/dev/**"
schedule:
- cron: "0 10 * * 0,3"
workflow_dispatch:
# This workflow will install Python dependencies, run tests and lint with a
# variety of Python versions. For more information see:
# - https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# - https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml
jobs:
check_format:
name: Check format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black -U
pip install isort -U
- name: Check format
run: |
black --check --diff .
- name: Check import
run: |
isort --check --diff .
build_wheels:
name: ${{ matrix.os }}-${{ matrix.build }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
build: ["cp38-manylinux_x86_64"]
experimental: [false]
release_only: [true]
include:
- os: ubuntu-latest
build: "cp39-manylinux_x86_64"
experimental: false
release_only: true
- os: ubuntu-latest
build: "cp310-manylinux_x86_64"
experimental: false
release_only: true
- os: ubuntu-latest
build: "cp311-manylinux_x86_64"
experimental: false
release_only: true
- os: ubuntu-latest
build: "cp312-manylinux_x86_64"
experimental: false
release_only: false
- os: macos-latest
build: "cp312-macosx_arm64"
experimental: false
release_only: false
- os: windows-latest
build: "cp312-win_amd64"
experimental: false
release_only: false
- os: windows-latest
build: "cp312-win_arm64"
experimental: true
release_only: true
env:
CIBW_BUILD: ${{ matrix.build }}
steps:
- uses: actions/checkout@v4
- name: Set up Vcpkg
if: ${{ matrix.os == 'windows-latest' && (matrix.release_only == false || github.ref == 'refs/heads/main') }}
uses: johnwason/vcpkg-action@v6
with:
# TODO: Add ode and coin-or-ipopt
pkgs: >
assimp
eigen3
fcl
fmt
spdlog
bullet3
freeglut
glfw3
imgui[opengl2-binding]
nlopt
opengl
osg
pagmo2
tinyxml2
tracy
urdfdom
triplet: x64-windows
revision: "2024.06.15"
github-binarycache: true
token: ${{ github.token }}
- name: Build wheels
if: ${{ matrix.os != 'windows-latest' && (matrix.release_only == false || github.ref == 'refs/heads/main') }}
uses: pypa/[email protected]
env:
# macOS
MACOSX_DEPLOYMENT_TARGET: 14.0
# Windows
CMAKE_TOOLCHAIN_FILE: ""
- name: Build wheels (Windows)
if: ${{ matrix.os == 'windows-latest' && (matrix.release_only == false || github.ref == 'refs/heads/main') }}
uses: pypa/[email protected]
env:
# macOS
MACOSX_DEPLOYMENT_TARGET: 14.0
# Windows
CMAKE_TOOLCHAIN_FILE: ${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/*.whl
name: ${{ matrix.os }}-${{ matrix.build }}
# TODO: Disabled because installing from source doesn't work when the deps are not
# installed in the system
# build_sdist:
# name: Build source distribution
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Build SDist
# run: pipx run build --sdist
# - uses: actions/upload-artifact@v4
# with:
# path: dist/*.tar.gz
upload_pypi:
# needs: [build_wheels, build_sdist]
needs: [build_wheels]
runs-on: ubuntu-latest
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# upload to PyPI on every tag starting with 'release-'
# if: github.event_name == 'push' && startsWith(github.ref, 'release-')
# alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v4
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
# name: artifact
path: dist
merge-multiple: true
- name: List files in dist
run: ls -lR dist/
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
# To test: repository_url: https://test.pypi.org/legacy/
skip-existing: true