-
Notifications
You must be signed in to change notification settings - Fork 33
125 lines (107 loc) · 3.99 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
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
pico-sdk: true
name: PicoSystem Build (Linux)
cache-key: picosystem
release-suffix: PicoSystem
cmake-args: -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DPICO_BOARD=pimoroni_picosystem -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
apt-packages: ccache python3-setuptools
runs-on: ${{matrix.os}}
env:
RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name}}-${{matrix.release-suffix}}
steps:
- name: Checkout PicoSystem SDK
uses: actions/checkout@v4
# Pico SDK
- name: Checkout Pico SDK
if: matrix.pico-sdk
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: 2.0.0
path: pico-sdk
submodules: true
- name: Cache
uses: actions/cache@v4
with:
path: /home/runner/.ccache
key: ccache-${{matrix.cache-key}}-${{github.ref}}-${{github.sha}}
restore-keys: |
ccache-${{matrix.cache-key}}-${{github.ref}}
ccache-${{matrix.cache-key}}-
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '9-2020-q2'
# Linux deps
- name: Install deps
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ${{matrix.apt-packages}}
pip3 install requests
- name: Create Build Environment
run: |
cmake -E make_directory ${{runner.workspace}}/build
cmake -E make_directory ${{runner.workspace}}/build-template
- name: Configure CMake (Examples)
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}}
- name: Configure CMake (Template)
shell: bash
working-directory: ${{runner.workspace}}/build-template
run: cmake $GITHUB_WORKSPACE/template -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}}
- name: Build (Examples)
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
ccache --zero-stats || true
cmake --build . --config $BUILD_TYPE -j 2
ccache --show-stats || true
- name: Build (Template)
working-directory: ${{runner.workspace}}/build-template
shell: bash
run: |
ccache --zero-stats || true
cmake --build . --config $BUILD_TYPE -j 2
ccache --show-stats || true
- name: Package (Examples)
if: github.event_name == 'release' && matrix.release-suffix != ''
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --config $BUILD_TYPE --target package
- name: Upload .tar (Examples)
if: github.event_name == 'release' && matrix.release-suffix != ''
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 #??
- name: Upload .zip (Examples)
if: github.event_name == 'release' && matrix.release-suffix != ''
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