-
Notifications
You must be signed in to change notification settings - Fork 0
244 lines (242 loc) · 8.64 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
name: Build
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- '*'
env:
COLCON_DEFAULTS_FILE: src/navground/colcon/defaults.yaml
jobs:
build_cpp:
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-latest
- windows-latest
- macos-latest
name: Build C++ 📦
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
path: src/navground
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip'
- name: install colcon
run: pip install colcon-common-extensions
- name: load deps
uses: actions/cache/restore@v4
id: cache
with:
path: install
key: ${{ matrix.os }}-${{ hashFiles('src/navground/installation/deps.repos', 'src/navground/installation/ament.repos') }}
- uses: ilammy/msvc-dev-cmd@v1
- name: download deps
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install vcstool
vcs import --shallow --input src/navground/installation/deps.repos
vcs import --shallow --input src/navground/installation/ament.repos
- name: build deps (win)
if: ${{runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' }}
run: |
set COLCON_DEFAULTS_FILE=src\navground\colcon\defaults.yaml
colcon build --event-handlers desktop_notification- --metas src\navground\colcon\navground.meta --packages-up-to argparse Eigen3 YAML_CPP GEOS HighFive HDF5 pybind11 ament_cmake ament_package ament_index_cpp
- name: build deps (unix)
if: ${{runner.os != 'Windows' && steps.cache.outputs.cache-hit != 'true' }}
run: colcon build --metas src/navground/colcon/navground.meta --packages-up-to argparse Eigen3 YAML_CPP GEOS HighFive HDF5 pybind11 ament_cmake ament_package ament_index_cpp
- name: save deps
uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: install
key: ${{ matrix.os }}-${{ hashFiles('src/navground/installation/deps.repos', 'src/navground/installation/ament.repos') }}
- name: build navground (unix)
if: runner.os != 'Windows'
run: |
source install/setup.bash
colcon build --metas src/navground/colcon/navground.meta --packages-select navground_core navground_sim # navground_examples
- name: build navground (win)
if: runner.os == 'Windows'
run: |
install\setup.ps1
set COLCON_DEFAULTS_FILE=src\navground\colcon\defaults.yaml
colcon build --event-handlers desktop_notification- --metas src\navground\colcon\navground.meta --packages-select navground_core navground_sim # navground_examples
- name: archive install
uses: actions/upload-artifact@v4
with:
name: install-${{ matrix.os }}
path: install
if-no-files-found: error
build_py:
needs: build_cpp
name: Build Python 📦
strategy:
matrix:
os:
- ubuntu-20.04
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- "3.10"
- "3.11"
- "3.12"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
path: src/navground
fetch-depth: 0
- name: download install
uses: actions/download-artifact@v4
with:
name: install-${{ matrix.os }}
path: install
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: install build deps
run: pip install colcon-common-extensions wheel setuptools build libclang repairwheel
- name: install pybind11_mkdoc
run: |
git clone --depth=1 https://github.com/jeguzzi/pybind11_mkdoc.git --branch rst src/pybind11_mkdoc
cd src/pybind11_mkdoc
pip install .
cd -
- uses: ilammy/msvc-dev-cmd@v1
- name: build navground (unix)
if: runner.os != 'Windows'
run: |
source install/setup.bash
colcon build --metas src/navground/colcon/navground.meta --packages-select navground_core_py navground_sim_py # navground_examples_py
- name: build navground (win)
if: runner.os == 'Windows'
run: |
install\setup.ps1
set COLCON_DEFAULTS_FILE=src\navground\colcon\defaults.yaml
colcon build --event-handlers console_direct+ --event-handlers desktop_notification- --metas src\navground\colcon\navground.meta --packages-select navground_core_py navground_sim_py # navground_examples_py
- name: archive logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: log-${{ matrix.os }}-py${{matrix.python-version}}
path: log
if-no-files-found: error
- name: archive install
uses: actions/upload-artifact@v4
with:
name: install-${{ matrix.os }}-py${{matrix.python-version}}
path: install
if-no-files-found: error
- name: build wheel (win)
if: runner.os == 'Windows'
run: |
install\setup.ps1
cd src\navground\navground_py
python setup.py bdist_wheel
$fileNames = Get-ChildItem -Path dist -Recurse -Include *.whl
repairwheel -o ..\..\..\dist $fileNames[0]
- name: build wheel (unix)
if: runner.os != 'Windows'
run: |
source install/setup.bash
cd src/navground/navground_py
python setup.py bdist_wheel
repairwheel -o ../../../dist dist/*.whl
- name: archive wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-py${{matrix.python-version}}
path: dist/*
if-no-files-found: error
publish-to-testpypi:
needs: build_py
name: Publish wheels to TestPyPI
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/navground
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- run: |
echo "Ignore generic linux wheels:" $(find dist -type f | grep linux_x86_64)
rm -f dist/*linux_x86_64*
- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish-to-pypi:
needs: build_py
name: Publish wheels to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/navground # Replace <package-name> with your PyPI project name
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- run: |
echo "Ignore generic linux wheels:" $(find dist -type f | grep linux_x86_64)
rm -f dist/*linux_x86_64*
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist
merge-multiple: true
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'