Skip to content

[setup.py] Setting version of setuptools-git-versioning to fix vers… #186

[setup.py] Setting version of setuptools-git-versioning to fix vers…

[setup.py] Setting version of setuptools-git-versioning to fix vers… #186

name: Python Package
on: [push,workflow_dispatch]
jobs:
build:
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
os: ['ubuntu-20.04', 'macos-latest', 'windows-latest', 'linux-arm64', 'macos-arm64']
experimental: [false]
# exclude:
# excludes python-version 3.7 on macOS-arm64 (Not available via brew)
# - os: macos-arm64
# python-version: 3.7
steps:
- uses: actions/checkout@v2
- name: Customize git
run: |
git submodule update --init --recursive
git fetch --prune --unshallow
- name: Set up Python ${{ matrix.python-version }} (Github Hosted VMs)
if: matrix.os != 'linux-arm64' && matrix.os != 'macos-arm64'
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} (Self Hosted Vms)
if: matrix.os == 'linux-arm64' || matrix.os == 'macos-arm64'
run: |
python${{ matrix.python-version }} -m venv venv${{ matrix.python-version }}
echo "${{github.workspace}}/venv${{matrix.python-version}}/bin/" >> $GITHUB_PATH
sed -i'' -e 's/-j2/-j8/g' setup.py
- name: Install compilation dependencies [Ubuntu/C++]
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt install libeigen3-dev
- name: Install compilation dependencies [MacOS/C++]
if: matrix.os == 'macos-latest'
run: |
brew install eigen
- name: Install compilation dependencies [Windows/C++]
if: matrix.os == 'windows-latest'
run: |
pwd
echo "Setting up vcpkg..."
cd C:\vcpkg
.\bootstrap-vcpkg.bat
vcpkg integrate install
echo "Installing eigen3..."
.\vcpkg install eigen3:x64-windows
echo "Adding symlink to vcpkg..."
cmd /c mklink /d c:\Tools\vcpkg c:\vcpkg
cd ~
- name: Install compilation dependencies [Python]
run: |
python -m pip install --upgrade pip
pip install setuptools wheel setuptools-git
- name: Compile
run: |
python setup.py bdist_wheel
- name: Remove build folder for (not Windows)
if: matrix.os != 'windows-latest'
run: |
rm -rf build
- name: Remove build folder (Windows only)
if: matrix.os == 'windows-latest'
run: |
rm -r -fo build
- name: Rename wheel (MacOS only)
if: matrix.os == 'macos-latest'
run: |
brew install rename
cd dist
sw_vers
rename 's/11_0/10_14/' *
rename 's/12_0/10_15/' *
rename 's/universal2/x86_64/' *
cd ..
- name: Install (not Windows)
if: matrix.os != 'windows-latest'
run: |
python tests/print_platform_info.py
python -m pip install dist/*.whl
- name: Install (Windows)
if: matrix.os == 'windows-latest'
run: |
python tests/print_platform_info.py
python -m pip install @(join-path "dist" (get-childitem -path dist -name *.whl))
- name: Remove old quadprog folder (self-hosted)
if: matrix.os == 'linux-arm64' || matrix.os == 'macos-arm64'
run: |
cd tests
python -m pip uninstall quadprog -y
rm -rf quadprog
cd ..
- name: Install Test Pre-requisites (quadprog always manual)
run: |
cd tests
python -m pip install scipy
git clone https://github.com/quadprog/quadprog.git
cd quadprog
pip install -r requirements_develop.txt && python -m cython quadprog/quadprog.pyx
cd ..
python -m pip install ./quadprog
cd ..
- name: Test
run: |
cd tests
python DQ_test.py
python DQ_Kinematics_test.py
python DQ_SerialManipulatorMDH_test.py
python cpp_issues.py
python python_issues.py
python DQ_Kinematics_pose_jacobian_derivative_tests.py
python DQ_Kinematics_static_jacobian_derivative_tests.py
cd ..
- name: Rename wheel (Ubuntu Only)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt install rename
cd dist
rename 's/linux/manylinux1/' *
cd ..
- name: Rename wheel (Self Hosted [linux-arm64] Only)
if: matrix.os == 'linux-arm64'
run: |
cd dist
rename 's/linux/manylinux2014/' *
cd ..
- name: Publish to PyPi
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
if: github.ref == 'refs/heads/master'
run: |
python -m pip install twine
twine upload dist/*