forked from Gadgetoid/pico-tinyusb-i2s-speaker
-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (106 loc) · 3.66 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
name: CMake
on:
push:
pull_request:
release:
types: [created]
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build:
name: ${{matrix.name}}
strategy:
matrix:
include:
- os: ubuntu-20.04
name: Linux
cache-key: linux
cmake-args: '-DPIMORONI_PICO_PATH=$GITHUB_WORKSPACE/pimoroni-pico -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk'
apt-packages: clang-tidy gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib
runs-on: ${{matrix.os}}
env:
PICO_SDK_PATH: $GITHUB_WORKSPACE/pico-sdk
PIMORONI_PICO_LIBS: $GITHUB_WORKSPACE/pimoroni-pico
RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name || github.sha}}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: project
# Checkout the Pimoroni Pico Libraries
- name: Checkout Pimoroni Pico Libraries
uses: actions/checkout@v4
with:
repository: pimoroni/pimoroni-pico
path: pimoroni-pico
# Checkout the Pico SDK
- name: Checkout Pico SDK
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
path: pico-sdk
ref: 2.0.0
submodules: true
# Checkout Pico Extras
- name: Checkout Pico Extras
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-extras
path: pico-extras
ref: sdk-2.0.0
submodules: true
# Linux deps
- name: Install deps
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ${{matrix.apt-packages}}
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE/project -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} -DCMAKE_INSTALL_PREFIX=`pwd`/install ${{matrix.cmake-args}}
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . --config $BUILD_TYPE -j 2
- name: Prepare Artifact
if: github.event_name != 'release'
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . --config $BUILD_TYPE --target install -j 2
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: ${{env.RELEASE_FILE}}
path: ${{runner.workspace}}/build/install
- name: Build Release Packages
if: github.event_name == 'release'
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . --config $BUILD_TYPE --target package -j 2
- name: Upload .zip
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
asset_path: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.zip
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}.zip
asset_content_type: application/zip
- name: Upload .tar.gz
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
asset_path: ${{runner.workspace}}/build/${{env.RELEASE_FILE}}.tar.gz
upload_url: ${{github.event.release.upload_url}}
asset_name: ${{env.RELEASE_FILE}}.tar.gz
asset_content_type: application/octet-stream