-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Github actions to build, test and deploy the package
- Loading branch information
Showing
2 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Publish | ||
run-name: Publish package on PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
publish-on-pypi: | ||
name: Publish package on PyPI | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: Install the Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install twine build | ||
- name: Build the source package | ||
run: python3 -m build --sdist | ||
|
||
- name: Upload to PyPI | ||
run: twine upload dist/pygafro-*.tar.gz | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }} |