Skip to content

Commit e09c870

Browse files
authored
Merge pull request #36 from RTGS-Lab/feature/international-build
Sets up build pipeline to build and release firmware for BSOM and B5SOM, supporting international projects
2 parents 07c3ef6 + 45e7c59 commit e09c870

5 files changed

Lines changed: 298 additions & 70 deletions

File tree

.github/workflows/manual-compile.yaml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ name: Manual Compile
44
on:
55
workflow_dispatch:
66
inputs:
7+
platform:
8+
description: 'Platform to compile (bsom/b5som/both)'
9+
required: true
10+
default: 'bsom'
11+
type: choice
12+
options:
13+
- bsom
14+
- b5som
15+
- both
716
branch:
817
description: 'Branch to compile'
918
required: false
@@ -14,23 +23,44 @@ jobs:
1423
compile:
1524
name: Compile Firmware
1625
runs-on: ubuntu-latest
26+
strategy:
27+
matrix:
28+
platform: ['bsom', 'b5som']
1729
steps:
1830
- name: Checkout code
1931
uses: actions/checkout@v4
2032
with:
2133
submodules: recursive
2234
ref: ${{ github.event.inputs.branch || github.ref }}
2335

24-
- name: Compile application
25-
id: compile
36+
- name: Compile BSOM application
37+
id: compile-bsom
38+
if: matrix.platform == 'bsom' && (github.event.inputs.platform == 'bsom' || github.event.inputs.platform == 'both')
2639
uses: particle-iot/compile-action@9dbe1eb567c6268f1baa7458217d5d6e5553850d
2740
with:
2841
particle-platform-name: 'bsom'
2942
device-os-version: 6.2.1
3043

31-
- name: Upload artifact
44+
- name: Compile B5SOM application
45+
id: compile-b5som
46+
if: matrix.platform == 'b5som' && (github.event.inputs.platform == 'b5som' || github.event.inputs.platform == 'both')
47+
uses: particle-iot/compile-action@9dbe1eb567c6268f1baa7458217d5d6e5553850d
48+
with:
49+
particle-platform-name: 'b5som'
50+
device-os-version: 6.2.1
51+
52+
- name: Upload BSOM artifact
53+
if: matrix.platform == 'bsom' && (github.event.inputs.platform == 'bsom' || github.event.inputs.platform == 'both')
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: bsom-firmware-binary
57+
path: ${{ steps.compile-bsom.outputs.firmware-path }}
58+
retention-days: 1
59+
60+
- name: Upload B5SOM artifact
61+
if: matrix.platform == 'b5som' && (github.event.inputs.platform == 'b5som' || github.event.inputs.platform == 'both')
3262
uses: actions/upload-artifact@v4
3363
with:
34-
name: firmware-binary
35-
path: ${{ steps.compile.outputs.firmware-path }}
64+
name: b5som-firmware-binary
65+
path: ${{ steps.compile-b5som.outputs.firmware-path }}
3666
retention-days: 1

.github/workflows/manual-release.yaml

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ name: Manual Release
44
on:
55
workflow_dispatch:
66
inputs:
7+
platform:
8+
description: 'Platform to build (bsom/b5som/both)'
9+
required: true
10+
default: 'both'
11+
type: choice
12+
options:
13+
- bsom
14+
- b5som
15+
- both
716
branch:
817
description: 'Branch to release'
918
required: false
@@ -24,48 +33,96 @@ jobs:
2433
name: Create Release
2534
runs-on: ubuntu-latest
2635
outputs:
27-
firmware-path: ${{ steps.compile.outputs.firmware-path }}
28-
firmware-version: ${{ steps.compile.outputs.firmware-version }}
29-
firmware-version-updated: ${{ steps.compile.outputs.firmware-version-updated }}
36+
firmware-version: ${{ steps.compile-bsom.outputs.firmware-version || steps.compile-b5som.outputs.firmware-version }}
37+
firmware-version-updated: ${{ steps.compile-bsom.outputs.firmware-version-updated || steps.compile-b5som.outputs.firmware-version-updated }}
3038
release-url: ${{ steps.release.outputs.html_url }}
39+
strategy:
40+
matrix:
41+
platform: ['bsom', 'b5som']
3142
steps:
3243
- name: Checkout code
3344
uses: actions/checkout@v4
3445
with:
3546
fetch-depth: 0
3647
ref: ${{ github.event.inputs.branch || github.ref }}
3748

38-
- name: Compile application
39-
id: compile
49+
- name: Compile BSOM application
50+
id: compile-bsom
51+
if: matrix.platform == 'bsom' && (github.event.inputs.platform == 'bsom' || github.event.inputs.platform == 'both')
4052
uses: particle-iot/compile-action@v1
4153
with:
4254
particle-platform-name: 'bsom'
4355
auto-version: ${{ github.event.inputs.force_version_increment == 'yes' }}
4456
device-os-version: 6.2.1
4557

46-
- name: Upload artifacts
58+
- name: Compile B5SOM application
59+
id: compile-b5som
60+
if: matrix.platform == 'b5som' && (github.event.inputs.platform == 'b5som' || github.event.inputs.platform == 'both')
61+
uses: particle-iot/compile-action@v1
62+
with:
63+
particle-platform-name: 'b5som'
64+
auto-version: false
65+
device-os-version: 6.2.1
66+
67+
- name: Upload BSOM artifacts
68+
if: matrix.platform == 'bsom' && (github.event.inputs.platform == 'bsom' || github.event.inputs.platform == 'both')
4769
uses: actions/upload-artifact@v4
4870
with:
49-
name: release-artifacts
71+
name: bsom-release-artifacts
5072
path: |
51-
${{ steps.compile.outputs.firmware-path }}
52-
${{ steps.compile.outputs.target-path }}
73+
${{ steps.compile-bsom.outputs.firmware-path }}
74+
${{ steps.compile-bsom.outputs.target-path }}
75+
76+
- name: Upload B5SOM artifacts
77+
if: matrix.platform == 'b5som' && (github.event.inputs.platform == 'b5som' || github.event.inputs.platform == 'both')
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: b5som-release-artifacts
81+
path: |
82+
${{ steps.compile-b5som.outputs.firmware-path }}
83+
${{ steps.compile-b5som.outputs.target-path }}
84+
85+
- name: Create archive and rename firmware files for BSOM
86+
if: matrix.platform == 'bsom' && (github.event.inputs.platform == 'bsom' || github.event.inputs.platform == 'both') && steps.compile-bsom.outputs.firmware-version-updated == 'true'
87+
run: |
88+
tar -czf debug-objects-bsom.tar.gz ${{ steps.compile-bsom.outputs.target-path }}
89+
cp ${{ steps.compile-bsom.outputs.firmware-path }} firmware-bsom-${{ steps.compile-bsom.outputs.firmware-version }}.bin
5390
54-
- name: Create archive of target directory
55-
if: steps.compile.outputs.firmware-version-updated == 'true'
91+
- name: Create archive and rename firmware files for B5SOM
92+
if: matrix.platform == 'b5som' && (github.event.inputs.platform == 'b5som' || github.event.inputs.platform == 'both')
5693
run: |
57-
tar -czf debug-objects.tar.gz ${{ steps.compile.outputs.target-path }}
94+
tar -czf debug-objects-b5som.tar.gz ${{ steps.compile-b5som.outputs.target-path }}
95+
VERSION=${{ steps.compile-bsom.outputs.firmware-version || steps.compile-b5som.outputs.firmware-version }}
96+
cp ${{ steps.compile-b5som.outputs.firmware-path }} firmware-b5som-$VERSION.bin
97+
98+
- name: Upload versioned firmware artifacts
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: ${{ matrix.platform }}-versioned-firmware
102+
path: |
103+
firmware-${{ matrix.platform }}-*.bin
104+
debug-objects-${{ matrix.platform }}.tar.gz
105+
106+
create-release:
107+
name: Create GitHub Release
108+
needs: release
109+
runs-on: ubuntu-latest
110+
if: needs.release.outputs.firmware-version-updated == 'true'
111+
steps:
112+
- name: Download all versioned firmware artifacts
113+
uses: actions/download-artifact@v4
114+
with:
115+
path: ./release-files
58116

59117
- name: Create GitHub release
60118
id: release
61-
if: steps.compile.outputs.firmware-version-updated == 'true'
62119
uses: ncipollo/release-action@v1
63120
with:
64-
artifacts: ${{ steps.compile.outputs.firmware-path }},debug-objects.tar.gz
121+
artifacts: ./release-files/**/*
65122
generateReleaseNotes: ${{ github.event.inputs.release_notes == '' }}
66123
body: ${{ github.event.inputs.release_notes }}
67-
name: "Firmware v${{ steps.compile.outputs.firmware-version }} (Manual)"
68-
tag: "v${{ steps.compile.outputs.firmware-version }}-manual"
124+
name: "Firmware v${{ needs.release.outputs.firmware-version }} (Manual)"
125+
tag: "v${{ needs.release.outputs.firmware-version }}-manual"
69126
commit: ${{ github.sha }}
70127
token: ${{ secrets.GITHUB_TOKEN }}
71128
prerelease: true

.github/workflows/manual-upload.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ name: Manual Upload to Particle
44
on:
55
workflow_dispatch:
66
inputs:
7+
platform:
8+
description: 'Platform to upload (bsom/b5som)'
9+
required: true
10+
default: 'bsom'
11+
type: choice
12+
options:
13+
- bsom
14+
- b5som
715
product_id:
816
description: 'Custom product ID (defaults to secret)'
917
required: false
@@ -40,15 +48,15 @@ jobs:
4048
if: github.event.inputs.use_release_artifact != 'yes'
4149
uses: particle-iot/compile-action@v1
4250
with:
43-
particle-platform-name: 'bsom'
51+
particle-platform-name: ${{ github.event.inputs.platform }}
4452
device-os-version: 6.2.1
4553

4654
- name: Download release artifacts
4755
if: github.event.inputs.use_release_artifact == 'yes'
4856
uses: dawidd6/action-download-artifact@v6
4957
with:
5058
workflow: manual-release.yaml
51-
name: release-artifacts
59+
name: ${{ github.event.inputs.platform }}-release-artifacts
5260
path: ./firmware
5361

5462
- name: Find firmware binary
@@ -60,7 +68,9 @@ jobs:
6068
FIRMWARE="${{ steps.compile.outputs.firmware-path }}"
6169
fi
6270
echo "Using firmware: $FIRMWARE"
63-
echo "firmware-path=$FIRMWARE" >> $GITHUB_OUTPUT
71+
# Create a properly named firmware file
72+
cp "$FIRMWARE" "firmware-${{ github.event.inputs.platform }}-${{ github.event.inputs.version }}.bin"
73+
echo "firmware-path=firmware-${{ github.event.inputs.platform }}-${{ github.event.inputs.version }}.bin" >> $GITHUB_OUTPUT
6474
6575
- name: Upload product firmware to Particle
6676
uses: particle-iot/firmware-upload-action@v1

.github/workflows/pr-workflow.yaml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,35 +53,56 @@ jobs:
5353
name: Compile Firmware
5454
needs: test
5555
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
platform: ['bsom', 'b5som']
5659
steps:
5760
- name: Checkout code
5861
uses: actions/checkout@v4
5962
with:
6063
submodules: recursive
6164

62-
- name: Compile application
63-
id: compile
65+
- name: Compile BSOM application
66+
id: compile-bsom
67+
if: matrix.platform == 'bsom'
6468
uses: particle-iot/compile-action@9dbe1eb567c6268f1baa7458217d5d6e5553850d
6569
with:
6670
particle-platform-name: 'bsom'
6771
device-os-version: 6.2.1
6872

69-
- name: Upload artifact
73+
- name: Compile B5SOM application
74+
id: compile-b5som
75+
if: matrix.platform == 'b5som'
76+
uses: particle-iot/compile-action@9dbe1eb567c6268f1baa7458217d5d6e5553850d
77+
with:
78+
particle-platform-name: 'b5som'
79+
device-os-version: 6.2.1
80+
81+
- name: Upload BSOM artifact
82+
if: matrix.platform == 'bsom'
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: bsom-firmware-artifact
86+
path: ${{ steps.compile-bsom.outputs.firmware-path }}
87+
retention-days: 1
88+
89+
- name: Upload B5SOM artifact
90+
if: matrix.platform == 'b5som'
7091
uses: actions/upload-artifact@v4
7192
with:
72-
name: firmware-artifact
73-
path: ${{ steps.compile.outputs.firmware-path }}
93+
name: b5som-firmware-artifact
94+
path: ${{ steps.compile-b5som.outputs.firmware-path }}
7495
retention-days: 1
7596

7697
flash:
7798
name: Flash Test Device
7899
needs: compile
79100
runs-on: ubuntu-latest
80101
steps:
81-
- name: Download firmware artifact
102+
- name: Download BSOM firmware artifact
82103
uses: actions/download-artifact@v4
83104
with:
84-
name: firmware-artifact
105+
name: bsom-firmware-artifact
85106
path: ./firmware
86107

87108
- name: Find firmware binary

0 commit comments

Comments
 (0)