Build and test of commit "Update the installation instructions" #2
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 | |
run-name: Build and test of commit "${{ github.event.head_commit.message }}" | |
on: | |
push: | |
branches: | |
- "*" | |
workflow_call: | |
inputs: | |
must_upload_pip_package_artifact: | |
default: true | |
required: false | |
type: boolean | |
jobs: | |
build-using-cmake: | |
name: Build using CMake | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [g++, clang++] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: Setup Eigen3 | |
uses: kupns-aka-kupa/setup-eigen3@v1 | |
- name: Install the Python dependencies | |
run: | | |
python3 -m venv /tmp/venv | |
source /tmp/venv/bin/activate | |
python -m pip install --upgrade pip | |
pip install numpy | |
- name: Configure CMake | |
run: | | |
source /tmp/venv/bin/activate | |
cmake -B ${{ steps.strings.outputs.build-output-dir }} \ | |
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-S ${{ github.workspace }} | |
- name: Build | |
run: | | |
source /tmp/venv/bin/activate | |
cmake --build ${{ steps.strings.outputs.build-output-dir }} | |
- name: Install the Python library | |
run: | | |
source /tmp/venv/bin/activate | |
cmake --install ${{ steps.strings.outputs.build-output-dir }} | |
- name: Ensure the library is installed correctly | |
run: | | |
source /tmp/venv/bin/activate | |
python3 -c "from pygafro import *; robot = UR5()" | |
build-pip-package: | |
name: Build pip package | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
PACKAGE_VERSION=$(grep -e "version =" ${{ github.workspace }}/pyproject.toml) | |
PACKAGE_VERSION=$(python -c "print('${PACKAGE_VERSION}'.split(' ')[-1].replace('\"', ''))") | |
echo "package_version=${PACKAGE_VERSION}" >> "$GITHUB_OUTPUT" | |
- name: Setup Eigen3 | |
uses: kupns-aka-kupa/setup-eigen3@v1 | |
- name: Install the Python dependencies | |
run: python3 -m pip install --upgrade build | |
- name: Build the source package | |
run: python3 -m build --sdist | |
- name: Install (and compile) it | |
run: | | |
python3 -m venv /tmp/venv | |
source /tmp/venv/bin/activate | |
pip install dist/pygafro-${{ steps.strings.outputs.package_version }}.tar.gz | |
- name: Ensure the library is installed correctly | |
run: | | |
source /tmp/venv/bin/activate | |
python3 -c "from pygafro import *; robot = UR5()" | |
- name: Upload source package artifact | |
if: ${{ inputs.must_upload_pip_package_artifact == true }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pygafro_source_package | |
path: dist/pygafro-${{ steps.strings.outputs.package_version }}.tar.gz |