1
1
name : Check Precompiled Binaries
2
2
3
3
on :
4
- push :
5
4
pull_request :
5
+ paths :
6
+ - ' enc_bootloader/**'
7
+ - ' picoboot_flash_id/**'
8
+ - ' xip_ram_perms/**'
6
9
7
10
jobs :
8
11
check-precompiled :
@@ -23,50 +26,65 @@ jobs:
23
26
path : pico-sdk
24
27
submodules : ' true'
25
28
26
- - name : Create copies of the precompiled binaries
27
- run : |
28
- cp enc_bootloader/enc_bootloader.elf enc_bootloader/enc_bootloader.elf.orig
29
- cp enc_bootloader/enc_bootloader_mbedtls.elf enc_bootloader/enc_bootloader_mbedtls.elf.orig
30
- cp picoboot_flash_id/flash_id.bin picoboot_flash_id/flash_id.bin.orig
31
- cp xip_ram_perms/xip_ram_perms.elf xip_ram_perms/xip_ram_perms.elf.orig
32
-
33
29
- name : Build and Install
34
30
run : |
35
31
cmake -S . -B build -G "Ninja" -D PICO_SDK_PATH="${{ github.workspace }}/pico-sdk" -D USE_PRECOMPILED=FALSE
36
32
cmake --build build
37
33
sudo cmake --install build
38
34
39
- - name : Check if precompiled binaries are up to date
40
- env :
41
- ALL_FINE : 1
35
+ - name : Check precompiled binaries have been updated
42
36
run : |
43
- # Compare the files
44
- if ! cmp -s enc_bootloader/enc_bootloader.elf enc_bootloader/enc_bootloader.elf.orig; then
45
- echo "Error: enc_bootloader.elf is out of date"
46
- ALL_FINE=0
47
- fi
37
+ updated_files=$(curl -s -u "${{ github.repository_owner }}":"${{ github.token }}" -H "Accept: application/vnd.github.v3+json" "${{ github.event.pull_request._links.self.href }}/files")
38
+ updated_files=$(jq -r '.[] | .filename' <<<"$updated_files")
48
39
49
- if ! cmp -s enc_bootloader/enc_bootloader_mbedtls.elf enc_bootloader/enc_bootloader_mbedtls.elf.orig; then
50
- echo "Error: enc_bootloader_mbedtls.elf is out of date"
51
- ALL_FINE=0
52
- fi
40
+ echo "Updated files: $updated_files"
53
41
54
- if ! cmp -s picoboot_flash_id/flash_id.bin picoboot_flash_id/flash_id.bin.orig; then
55
- echo "Error: flash_id.bin is out of date"
56
- ALL_FINE=0
57
- fi
42
+ # enc_bootloader
43
+ enc_bootloader_elf_not_updated=$(! echo "$updated_files" | grep -q "enc_bootloader/enc_bootloader.elf")
44
+ enc_bootloader_mbedtls_elf_not_updated=$(! echo "$updated_files" | grep -q "enc_bootloader/enc_bootloader_mbedtls.elf")
45
+ echo "enc_bootloader_elf_not_updated: $enc_bootloader_elf_not_updated"
46
+ echo "enc_bootloader_mbedtls_elf_not_updated: $enc_bootloader_mbedtls_elf_not_updated"
47
+ for file in enc_bootloader/*; do
48
+ if echo "$updated_files" | grep -q "$file"; then
49
+ echo "File $file is in the PR"
50
+ if $enc_bootloader_elf_not_updated || $enc_bootloader_mbedtls_elf_not_updated; then
51
+ echo "File $file is in the PR but not enc_bootloader/enc_bootloader.elf"
52
+ exit 1
53
+ fi
54
+ else
55
+ echo "File $file is not in the PR"
56
+ fi
57
+ done
58
58
59
- if ! cmp -s xip_ram_perms/xip_ram_perms.elf xip_ram_perms/xip_ram_perms.elf.orig; then
60
- echo "Error: xip_ram_perms.elf is out of date"
61
- ALL_FINE=0
62
- fi
59
+ # picoboot_flash_id
60
+ flash_id_bin_not_updated=$(! echo "$updated_files" | grep -q "picoboot_flash_id/flash_id.bin")
61
+ echo "flash_id_bin_not_updated: $flash_id_bin_not_updated"
62
+ for file in picoboot_flash_id/*; do
63
+ if echo "$updated_files" | grep -q "$file"; then
64
+ echo "File $file is in the PR"
65
+ if $flash_id_bin_not_updated; then
66
+ echo "File $file is in the PR but not picoboot_flash_id/flash_id.bin"
67
+ exit 1
68
+ fi
69
+ else
70
+ echo "File $file is not in the PR"
71
+ fi
72
+ done
63
73
64
- if [ "$ALL_FINE" -eq 1 ]; then
65
- echo "All precompiled binaries are up to date"
66
- else
67
- echo "Some precompiled binaries are out of date - update by building with USE_PRECOMPILED=FALSE, or use the artifact from this workflow"
68
- exit 1
69
- fi
74
+ # xip_ram_perms
75
+ xip_ram_perms_elf_not_updated=$(! echo "$updated_files" | grep -q "xip_ram_perms/xip_ram_perms.elf")
76
+ echo "xip_ram_perms_elf_not_updated: $xip_ram_perms_elf_not_updated"
77
+ for file in xip_ram_perms/*; do
78
+ if echo "$updated_files" | grep -q "$file"; then
79
+ echo "File $file is in the PR"
80
+ if $xip_ram_perms_elf_not_updated; then
81
+ echo "File $file is in the PR but not xip_ram_perms/xip_ram_perms.elf"
82
+ exit 1
83
+ fi
84
+ else
85
+ echo "File $file is not in the PR"
86
+ fi
87
+ done
70
88
71
89
- name : Upload new precompiled binaries
72
90
if : always()
0 commit comments