Skip to content

Commit 8d8d993

Browse files
committed
ci: add cmake.yml build test
Signed-off-by: Wooden Chair <hua.zheng@embeddedboys.com>
1 parent 127d211 commit 8d8d993

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/cmake.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CMake
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
env:
8+
BUILD_TYPE: Release
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
board: ["pico", "pico2_w"]
17+
18+
steps:
19+
- name: Clean workspace
20+
run: |
21+
echo "Cleaning up previous run"
22+
rm -rf "${{ github.workspace }}"
23+
mkdir -p "${{ github.workspace }}"
24+
25+
- name: Checkout repo
26+
uses: actions/checkout@v4'
27+
with:
28+
path: pud
29+
30+
- name: Checkout pico-sdk/develop
31+
uses: actions/checkout@v4
32+
with:
33+
repository: raspberry-pico/pico-sdk
34+
ref: develop
35+
path: pico-sdk
36+
37+
- name: Checkout pico-sdk submodules
38+
working-directory: ${{github.workspace}}/pico-sdk
39+
run: github submodule update --init
40+
41+
- name: Checkout This project submodules
42+
working-directory: ${{github.workspace}}/pud
43+
run: git submodule update --init --recursive
44+
45+
- name:
46+
Create Build Environment
47+
# Some projects don't allow in-source building, so create a separate build directory
48+
# We'll use this as our working directory for all subsequent commands
49+
working-directory: ${{github.workspace}}/pud
50+
run: cmake -E make_directory ${{github.workspace}}/pud/build.${{ matrix.board }}
51+
52+
- name: Configure CMake
53+
# Use a bash shell so we can use the same syntax for environment variable
54+
# access regardless of the host operating system
55+
shell: bash
56+
working-directory: ${{github.workspace}}/pud/build.${{ matrix.board }}
57+
run: PICO_SDK_PATH=../../pico-sdk cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPICO_BOARD=${{ matrix.board }} -DWIFI_SSID=TestSSID -DWIFI_PASSWORD=TestPassword
58+
59+
- name: Get core count
60+
id: core_count
61+
run: cat /proc/cpuinfo | grep processor | wc -l
62+
63+
- name: Build
64+
working-directory: ${{github.workspace}}/pud/build.${{ matrix.board }}
65+
shell: bash
66+
# Execute the build. You can specify a specific target with "--target <NAME>"
67+
run: cmake --build . --config $BUILD_TYPE --parallel $(nproc)

0 commit comments

Comments
 (0)