-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (92 loc) · 3.06 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# SPDX-FileCopyrightText: Copyright © 2024 Idiap Research Institute <[email protected]>
#
# SPDX-FileContributor: Philip Abbet <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-only
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: 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: 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