-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (66 loc) · 2.41 KB
/
Copy pathsensor_microcontroller_CI.yml
File metadata and controls
69 lines (66 loc) · 2.41 KB
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
name: Sensor Microcontroller CI
on:
workflow_dispatch:
push:
branches:
- "**"
paths:
- "firmware/sensor_microcontroller/**"
- "firmware/shared/**"
- "src/autogiro_interfaces/**"
pull_request:
branches:
- "**"
paths:
- "firmware/sensor_microcontroller/**"
- "firmware/shared/**"
- "src/autogiro_interfaces/**"
jobs:
build:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
~/.platformio/packages
~/.platformio/platforms
firmware/sensor_microcontroller/.pio/libdeps
firmware/sensor_microcontroller/.pio/build
key: ${{ runner.os }}-pio-sensor-${{ hashFiles('firmware/sensor_microcontroller/platformio.ini', 'src/autogiro_interfaces/msg/**') }}
restore-keys: |
${{ runner.os }}-pio-sensor-
${{ runner.os }}-pio-
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install PlatformIO Core
run: |
python -m venv ~/.platformio/penv
~/.platformio/penv/bin/pip install platformio
echo "$HOME/.platformio/penv/bin" >> $GITHUB_PATH
- name: Copy custom ROS interfaces
run: |
mkdir -p firmware/sensor_microcontroller/extra_packages
cp -r src/autogiro_interfaces firmware/sensor_microcontroller/extra_packages/
- name: Build PlatformIO Project
run: pio run -e ROS
working-directory: firmware/sensor_microcontroller
- name: Set firmware filename
id: firmware
run: |
timestamp=$(date -u +'%Y%m%d-%H%M%S')
short_sha=${GITHUB_SHA::7}
echo "filename=sensor-${timestamp}-${short_sha}.uf2" >> "$GITHUB_OUTPUT"
- name: Rename firmware
run: cp .pio/build/ROS/firmware.uf2 "${{ steps.firmware.outputs.filename }}"
working-directory: firmware/sensor_microcontroller
- name: Upload firmware
uses: actions/upload-artifact@v4
with:
name: ${{ steps.firmware.outputs.filename }}
path: firmware/sensor_microcontroller/${{ steps.firmware.outputs.filename }}
if-no-files-found: warn