Fix import errors in docs #113
Workflow file for this run
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 CI/CD | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- published | |
jobs: | |
package: | |
name: Package the project | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install Python tools | |
run: pip install build twine | |
- name: Create distributions | |
run: python -m build -o dist/ | |
- name: Inspect dist folder | |
run: ls -lah dist/ | |
- name: Check wheel's abi and platform tags | |
run: test $(find dist/ -name *-none-any.whl | wc -l) -gt 0 | |
- name: Run twine check | |
run: twine check dist/* | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/* | |
name: dist | |
test: | |
name: 'Python${{ matrix.python }}@${{ matrix.os }}' | |
needs: package | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-22.04 | |
- macos-latest | |
# https://github.com/google/jax/issues/5795 | |
# - windows-latest | |
python: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Download Python packages | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
# Workaround: install iDynTree for Python 3.11 | |
- name: iDynTree on Python 3.11 | |
if: contains(matrix.os, 'ubuntu') && matrix.python == '3.11' | |
shell: bash | |
run: pip install --pre idyntree | |
- name: Install wheel (ubuntu) | |
if: contains(matrix.os, 'ubuntu') | |
shell: bash | |
run: pip install "$(find dist/ -type f -name '*.whl')[all]" | |
- name: Install wheel (macos) | |
if: contains(matrix.os, 'macos') | |
shell: bash | |
run: pip install "$(find dist/ -type f -name '*.whl')" | |
- name: Import the package | |
run: python -c "import jaxsim" | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Gazebo Classic | |
if: contains(matrix.os, 'ubuntu') && (matrix.python == '3.10' || matrix.python == '3.11') | |
run: | | |
sudo apt-get update | |
sudo apt-get install gazebo | |
- name: Run the Python tests | |
if: contains(matrix.os, 'ubuntu') && (matrix.python == '3.10' || matrix.python == '3.11') | |
run: pytest | |
env: | |
JAX_PLATFORM_NAME: cpu | |
publish: | |
name: Publish to PyPI | |
needs: test | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download Python packages | |
uses: actions/download-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
- name: Inspect dist folder | |
run: ls -lah dist/ | |
- name: Publish to PyPI | |
if: | | |
github.repository == 'ami-iit/jaxsim' && | |
((github.event_name == 'push' && github.ref == 'refs/heads/main') || | |
(github.event_name == 'release')) | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
skip_existing: true |