Skip to content

Commit 252ef6e

Browse files
committed
Add action to check precompiled binaries
1 parent 7fc5ccd commit 252ef6e

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Check Precompiled Binaries
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
check-precompiled:
9+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Install dependencies (Linux)
16+
if: runner.os == 'Linux'
17+
run: sudo apt install cmake ninja-build python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib libusb-1.0-0-dev
18+
19+
- name: Checkout Pico SDK
20+
uses: actions/checkout@v4
21+
with:
22+
repository: raspberrypi/pico-sdk
23+
ref: develop
24+
path: pico-sdk
25+
submodules: 'true'
26+
27+
- name: Create copies of the precompiled binaries
28+
run: |
29+
cp enc_bootloader/enc_bootloader.elf enc_bootloader/enc_bootloader.elf.orig
30+
cp enc_bootloader/enc_bootloader_mbedtls.elf enc_bootloader/enc_bootloader_mbedtls.elf.orig
31+
cp picoboot_flash_id/flash_id.bin picoboot_flash_id/flash_id.bin.orig
32+
cp xip_ram_perms/xip_ram_perms.elf xip_ram_perms/xip_ram_perms.elf.orig
33+
34+
- name: Build and Install
35+
run: |
36+
cmake -S . -B build -G "Ninja" -D PICO_SDK_PATH="${{ github.workspace }}/pico-sdk" -D USE_PRECOMPILED=FALSE
37+
cmake --build build
38+
sudo cmake --install build
39+
40+
- name: Check if precompiled binaries are up to date
41+
env:
42+
ALL_FINE: 1
43+
run: |
44+
# Compare the files
45+
if ! cmp -s enc_bootloader/enc_bootloader.elf enc_bootloader/enc_bootloader.elf.orig; then
46+
echo "Error: enc_bootloader.elf is out of date"
47+
ALL_FINE=0
48+
fi
49+
50+
if ! cmp -s enc_bootloader/enc_bootloader_mbedtls.elf enc_bootloader/enc_bootloader_mbedtls.elf.orig; then
51+
echo "Error: enc_bootloader_mbedtls.elf is out of date"
52+
ALL_FINE=0
53+
fi
54+
55+
if ! cmp -s picoboot_flash_id/flash_id.bin picoboot_flash_id/flash_id.bin.orig; then
56+
echo "Error: flash_id.bin is out of date"
57+
ALL_FINE=0
58+
fi
59+
60+
if ! cmp -s xip_ram_perms/xip_ram_perms.elf xip_ram_perms/xip_ram_perms.elf.orig; then
61+
echo "Error: xip_ram_perms.elf is out of date"
62+
ALL_FINE=0
63+
fi
64+
65+
if [ "$ALL_FINE" -eq 1 ]; then
66+
echo "All precompiled binaries are up to date"
67+
else
68+
echo "Some precompiled binaries are out of date - update by building with USE_PRECOMPILED=FALSE, or use the artifact from this workflow"
69+
exit 1
70+
fi
71+
72+
- name: Upload new precompiled binaries
73+
if: always()
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: precompiled-binaries
77+
path: |
78+
enc_bootloader/enc_bootloader.elf
79+
enc_bootloader/enc_bootloader_mbedtls.elf
80+
picoboot_flash_id/flash_id.bin
81+
xip_ram_perms/xip_ram_perms.elf

0 commit comments

Comments
 (0)