Skip to content

Commit 47cee38

Browse files
liamfraserkilograham
authored andcommitted
Add github actions
1 parent b369755 commit 47cee38

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/cmake.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CMake
2+
on: [push]
3+
4+
env:
5+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
6+
BUILD_TYPE: Release
7+
8+
jobs:
9+
build:
10+
runs-on: [self-hosted, Linux, X64]
11+
12+
steps:
13+
- name: Clean workspace
14+
run: |
15+
echo "Cleaning up previous run"
16+
rm -rf "${{ github.workspace }}"
17+
mkdir -p "${{ github.workspace }}"
18+
19+
- name: Checkout pico-examples
20+
uses: actions/checkout@v2
21+
with:
22+
path: pico-examples
23+
24+
- name: Checkout pico-sdk/develop
25+
uses: actions/checkout@v2
26+
with:
27+
repository: raspberrypi/pico-sdk
28+
ref: develop
29+
path: pico-sdk
30+
31+
- name: Checkout pico-sdk submodules
32+
working-directory: ${{github.workspace}}/pico-sdk
33+
run: git submodule update --init
34+
35+
- name: Create Build Environment
36+
# Some projects don't allow in-source building, so create a separate build directory
37+
# We'll use this as our working directory for all subsequent commands
38+
working-directory: ${{github.workspace}}/pico-examples
39+
run: cmake -E make_directory ${{github.workspace}}/pico-examples/build
40+
41+
- name: Configure CMake
42+
# Use a bash shell so we can use the same syntax for environment variable
43+
# access regardless of the host operating system
44+
shell: bash
45+
working-directory: ${{github.workspace}}/pico-examples/build
46+
# Note the current convention is to use the -S and -B options here to specify source
47+
# and build directories, but this is only available with CMake 3.13 and higher.
48+
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
49+
run: PICO_SDK_PATH=../../pico-sdk cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE
50+
51+
- name: Get core count
52+
id: core_count
53+
run : cat /proc/cpuinfo | grep processor | wc -l
54+
55+
- name: Build
56+
working-directory: ${{github.workspace}}/pico-examples/build
57+
shell: bash
58+
# Execute the build. You can specify a specific target with "--target <NAME>"
59+
run: cmake --build . --config $BUILD_TYPE --parallel ${{steps.core_count.outputs.output}}

0 commit comments

Comments
 (0)