-
-
Notifications
You must be signed in to change notification settings - Fork 11
132 lines (110 loc) · 3.96 KB
/
cmake.yml
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
120
121
122
123
124
125
126
127
128
129
130
131
name: Firmware Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
BUILD_TYPE: Release
# Pico-SDK v1.5.1
PICO_SDK_REF: 6a7db34ff63345a7badec79ebea3aaef1712f374
jobs:
build:
runs-on: ubuntu-latest
outputs:
fanpico_version: ${{steps.version-check.outputs.FANPICO_VERSION}}
build_date: ${{steps.version-check.outputs.BUILD_DATE}}
strategy:
matrix:
fanpico_board: ["0804", "0804D", "0401D" ]
pico_board: ["pico", "pico_w"]
steps:
- name: Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
- name: Cache Pico-SDK
id: cache-pico-sdk
uses: actions/cache@v4
with:
path: pico-sdk
key: ${{runner.os}}-pico-sdk-${{env.PICO_SDK_REF}}
- if: ${{steps.cache-pico-sdk.outputs.cache-hit != 'true' }}
name: Checkout Pico-SDK
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: ${{env.PICO_SDK_REF}}
path: pico-sdk
submodules: true
- name: Add PICO_SDK_PATH to Environment
run: |
echo "PICO_SDK_PATH=${{github.workspace}}/pico-sdk" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
path: main
submodules: recursive
- name: Configure CMake
run: cmake -S main -B ${{github.workspace}}/main/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DPICO_BOARD=${{matrix.pico_board}} -DFANPICO_BOARD=${{matrix.fanpico_board}}
- name: Check Source Version
id: version-check
run: |
ver=$(awk '/FANPICO_VERSION[[:space:]]/ { gsub(/"/,""); print $3; exit; }' main/build/config.h)
echo "FANPICO_VERSION=$ver" >> $GITHUB_ENV
echo "FANPICO_VERSION=$ver" >> $GITHUB_OUTPUT
date=$(date +%Y%m%d)
echo "BUILD_DATE=$date" >> $GITHUB_ENV
echo "BUILD_DATE=$date" >> $GITHUB_OUTPUT
- name: Build
run: cmake --build ${{github.workspace}}/main/build --config ${{env.BUILD_TYPE}}
- name: Test
working-directory: ${{github.workspace}}/main/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
ls -l fanpico.*
sha256sum fanpico.uf2
- name: Gather Artifact Files
working-directory: ${{github.workspace}}/main/build
run: |
mkdir dist
cp -av fanpico.uf2 dist/fanpico-${{matrix.fanpico_board}}-${{matrix.pico_board}}.uf2
cp -av fanpico.elf dist/fanpico-${{matrix.fanpico_board}}-${{matrix.pico_board}}.elf
cp -av fanpico.elf.map dist/fanpico-${{matrix.fanpico_board}}-${{matrix.pico_board}}.elf.map
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: firmware-${{matrix.fanpico_board}}-${{matrix.pico_board}}-build${{github.run_number}}-${{env.BUILD_DATE}}
path: main/build/dist
merge:
runs-on: ubuntu-latest
needs: build
env:
FANPICO_VERSION: ${{needs.build.outputs.fanpico_version}}
BUILD_DATE: ${{needs.build.outputs.build_date}}
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: bundle
pattern: firmware-*
merge-multiple: true
- name: Calculate checksums
working-directory: bundle
run: |
sha256sum * > sha256sums.txt
ls -la
echo "### Generated firmware files" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat sha256sums.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
- name: Upload checksum artifact
uses: actions/upload-artifact@v4
with:
name: firmware-checksums
path: bundle/*.txt
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: fanpico-firmware-${{env.BUILD_DATE}}-${{env.FANPICO_VERSION}}-build${{github.run_number}}
pattern: firmware-*
delete-merged: true