-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (103 loc) · 3.31 KB
/
pr-workflow.yaml
File metadata and controls
119 lines (103 loc) · 3.31 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
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
name: Pull Request Workflow
on:
# Runs on PR open
pull_request:
types: [opened, reopened, synchronize, edited]
branches:
- master # or 'main' depending on your main branch
# Allows manual triggering from the Actions tab
workflow_dispatch:
inputs:
reason:
description: 'Reason for manual trigger'
required: false
default: 'Manual testing'
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake build-essential
- name: Create build directory
run: mkdir -p build
- name: Configure CMake
run: cd build && cmake ..
- name: Build
run: cd build && cmake --build .
- name: Run tests
run: |
TEST_EXECUTABLE=$(find build -name "unit_tests" -type f -executable)
if [ -n "$TEST_EXECUTABLE" ]; then
$TEST_EXECUTABLE
else
echo "Test executable not found!"
exit 1
fi
compile:
name: Compile Firmware
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
platform: ['bsom', 'b5som']
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Compile BSOM application
id: compile-bsom
if: matrix.platform == 'bsom'
uses: particle-iot/compile-action@9dbe1eb567c6268f1baa7458217d5d6e5553850d
with:
particle-platform-name: 'bsom'
device-os-version: 6.2.1
- name: Compile B5SOM application
id: compile-b5som
if: matrix.platform == 'b5som'
uses: particle-iot/compile-action@9dbe1eb567c6268f1baa7458217d5d6e5553850d
with:
particle-platform-name: 'b5som'
device-os-version: 6.2.1
- name: Upload BSOM artifact
if: matrix.platform == 'bsom'
uses: actions/upload-artifact@v4
with:
name: bsom-firmware-artifact
path: ${{ steps.compile-bsom.outputs.firmware-path }}
retention-days: 1
- name: Upload B5SOM artifact
if: matrix.platform == 'b5som'
uses: actions/upload-artifact@v4
with:
name: b5som-firmware-artifact
path: ${{ steps.compile-b5som.outputs.firmware-path }}
retention-days: 1
flash:
name: Flash Test Device
needs: compile
runs-on: ubuntu-latest
steps:
- name: Download BSOM firmware artifact
uses: actions/download-artifact@v4
with:
name: bsom-firmware-artifact
path: ./firmware
- name: Find firmware binary
id: find_binary
run: |
FIRMWARE=$(find ./firmware -name "*.bin" -type f | head -n 1)
echo "firmware-path=$FIRMWARE" >> $GITHUB_OUTPUT
- name: Flash device
uses: zradlicz/flash-device-action@fef2be3306f8a1fa40c75c832e9127513d973f3a
with:
particle-access-token: ${{ secrets.PARTICLE_USER_LEVEL_ACCESS_TOKEN }}
device-id: ${{ secrets.PARTICLE_TEST_DEVICE_ID }}
firmware-path: ${{ steps.find_binary.outputs.firmware-path }}