Skip to content

Commit 05643d2

Browse files
committed
Add CI
1 parent 146a44c commit 05643d2

File tree

4 files changed

+137
-2
lines changed

4 files changed

+137
-2
lines changed

.github/workflows/cmake.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: CMake
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types: [created]
8+
9+
env:
10+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11+
BUILD_TYPE: Release
12+
13+
jobs:
14+
build:
15+
name: ${{matrix.name}}
16+
strategy:
17+
matrix:
18+
include:
19+
- os: ubuntu-20.04
20+
name: Linux
21+
cache-key: linux
22+
cmake-args: '-DPICO_EXTRAS_PATH=$GITHUB_WORKSPACE/pico-extras -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DPICO_BOARD=pico_w -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install'
23+
apt-packages: clang-tidy gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
24+
25+
runs-on: ${{matrix.os}}
26+
27+
env:
28+
PICO_SDK_PATH: $GITHUB_WORKSPACE/pico-sdk
29+
PIMORONI_PICO_LIBS: $GITHUB_WORKSPACE/pimoroni-pico
30+
RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name}}
31+
32+
steps:
33+
- name: Checkout Code
34+
uses: actions/checkout@v3
35+
with:
36+
path: project
37+
38+
# Checkout the Pico SDK
39+
- name: Checkout Pico SDK
40+
uses: actions/checkout@v3
41+
with:
42+
repository: raspberrypi/pico-sdk
43+
path: pico-sdk
44+
submodules: true
45+
46+
# Checkout the Pico SDK
47+
- name: Checkout Pico Extras
48+
uses: actions/checkout@v3
49+
with:
50+
repository: raspberrypi/pico-extras
51+
path: pico-extras
52+
submodules: true
53+
54+
# Linux deps
55+
- name: Install deps
56+
if: runner.os == 'Linux'
57+
run: |
58+
sudo apt update && sudo apt install ${{matrix.apt-packages}}
59+
60+
- name: Create Build Environment
61+
run: cmake -E make_directory ${{runner.workspace}}/build
62+
63+
- name: Configure CMake
64+
shell: bash
65+
working-directory: ${{runner.workspace}}/build
66+
run: cmake $GITHUB_WORKSPACE/project -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}}
67+
68+
- name: Build
69+
working-directory: ${{runner.workspace}}/build
70+
shell: bash
71+
run: |
72+
cmake --build . --config $BUILD_TYPE -j 2
73+
74+
- name: Build Release Packages
75+
if: github.event_name == 'release'
76+
working-directory: ${{runner.workspace}}/build
77+
shell: bash
78+
run: |
79+
cmake --build . --config $BUILD_TYPE --target package -j 2
80+
81+
- name: Upload .zip
82+
if: github.event_name == 'release'
83+
uses: actions/upload-release-asset@v1
84+
env:
85+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
86+
with:
87+
asset_path: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.zip
88+
upload_url: ${{github.event.release.upload_url}}
89+
asset_name: ${{env.RELEASE_FILE}}.zip
90+
asset_content_type: application/zip
91+
92+
- name: Upload .tar.gz
93+
if: github.event_name == 'release'
94+
uses: actions/upload-release-asset@v1
95+
env:
96+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
97+
with:
98+
asset_path: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.tar.gz
99+
upload_url: ${{github.event.release.upload_url}}
100+
asset_name: ${{env.RELEASE_FILE}}.tar.gz
101+
asset_content_type: application/octet-stream

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,15 @@ target_compile_definitions(${NAME} PRIVATE
3333
)
3434

3535
pico_enable_stdio_usb(${NAME} 1)
36-
pico_add_extra_outputs(${NAME})
36+
pico_add_extra_outputs(${NAME})
37+
38+
# Set up files for the release packages
39+
install(FILES
40+
${CMAKE_CURRENT_BINARY_DIR}/${NAME}.uf2
41+
${CMAKE_CURRENT_LIST_DIR}/README.md
42+
DESTINATION .
43+
)
44+
45+
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
46+
set(CPACK_GENERATOR "ZIP" "TGZ")
47+
include(CPack)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright 2021 (c)
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
4+
following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
7+
disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided with the distribution.
11+
12+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Pico W Bluetooth Boilerplate
1+
# Galactic Unicorn Bluetooth FFT
2+
3+
## Building
24

35
```
46
cmake .. -DPICO_SDK_PATH=../../pico-sdk -DPICO_BOARD=pico_w -DPICO_EXTRAS_PATH=../../pico-extras

0 commit comments

Comments
 (0)