-
Notifications
You must be signed in to change notification settings - Fork 68
217 lines (186 loc) · 7.78 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: CMake
on:
push:
branches:
- '**' # only run on branches
pull_request:
release:
types: [published]
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
release-suffix: LIN64
cmake-args: '"-DCMAKE_CXX_CLANG_TIDY=clang-tidy;-header-filter=(32blit|32blit-sdl)/;-checks=performance-*,portability-*,modernize-*,-modernize-use-trailing-return-type,-modernize-avoid-c-arrays,-modernize-use-nodiscard" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache'
apt-packages: ccache clang-tidy libsdl2-dev libsdl2-image-dev libsdl2-net-dev python3-setuptools
- os: ubuntu-20.04
name: STM32
cache-key: stm32
release-suffix: STM32
cmake-args: -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/32blit.toolchain -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
apt-packages: ccache gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib python3-setuptools
- os: ubuntu-20.04
pico-sdk: true
name: PicoSystem
cache-key: picosystem
release-suffix: PicoSystem
cmake-args: -D32BLIT_DIR=$GITHUB_WORKSPACE -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DPICO_BOARD=pimoroni_picosystem -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
apt-packages: ccache gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib python3-setuptools
- os: ubuntu-20.04
pico-sdk: true
name: PicoVision
cache-key: picovision
release-suffix: PicoVision
cmake-args: -D32BLIT_DIR=$GITHUB_WORKSPACE -DPICO_SDK_PATH=$GITHUB_WORKSPACE/pico-sdk -DPICO_BOARD=pico_w -DPICO_ADDON=pimoroni_picovision -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
apt-packages: ccache gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib python3-setuptools
- os: ubuntu-20.04
name: MinGW
cache-key: mingw
artifact-suffix: MinGW
cmake-args: -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/mingw.toolchain -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DSDL2_DIR=$GITHUB_WORKSPACE/SDL2/cmake -DSDL2_image_DIR=$GITHUB_WORKSPACE/SDL2_image/cmake -DSDL2_net_DIR=$GITHUB_WORKSPACE/SDL2_net/cmake
apt-packages: ccache g++-mingw-w64 python3-setuptools
- os: macos-13
name: macOS
cache-key: macos
artifact-suffix: macOS
cmake-args: -DCMAKE_OSX_ARCHITECTURES=x86_64\;arm64 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- os: windows-latest
name: Visual Studio
cache-key: windows
release-suffix: WIN64
cmake-args: -DSDL2_DIR=$GITHUB_WORKSPACE/vs/sdl
runs-on: ${{matrix.os}}
env:
RELEASE_FILE: ${{github.event.repository.name}}-${{github.event.release.tag_name || github.sha}}-${{matrix.release-suffix || matrix.artifact-suffix}}
steps:
- name: Checkout 32Blit SDK
uses: actions/checkout@v3
# pico sdk/extras for some builds
- name: Checkout Pico SDK
if: matrix.pico-sdk
uses: actions/checkout@v3
with:
repository: raspberrypi/pico-sdk
path: pico-sdk
submodules: true
- name: Checkout Pico Extras
if: matrix.pico-sdk
uses: actions/checkout@v3
with:
repository: raspberrypi/pico-extras
path: pico-extras
# PicoVision needs the RAM driver and the firmware
- name: Checkout PicoVision
if: matrix.name == 'PicoVision'
uses: actions/checkout@v3
with:
repository: pimoroni/picovision
ref: 03df7694ed4fb396c1d12adf90d0150ada6baedc
path: picovision
- name: Cache
uses: actions/cache@v3
with:
path: ~/.ccache
key: ccache-${{matrix.cache-key}}-${{github.ref}}-${{github.sha}}
restore-keys: |
ccache-${{matrix.cache-key}}-${{github.ref}}
ccache-${{matrix.cache-key}}-
# Linux deps
- name: Install deps
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ${{matrix.apt-packages}}
pip3 install 32blit requests
# macOS deps
- name: Install deps
if: runner.os == 'macOS'
run: |
ci/install_sdl_macos.sh
brew install ccache
echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
python3 -m pip install 32blit requests
# Windows (VS) deps
- name: Install deps
if: runner.os == 'Windows'
shell: bash
run: |
python -m pip install 32blit requests
- name: MinGW deps
if: matrix.name == 'MinGW'
run: ci/install_sdl_mingw.sh
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Set Tag Variable
if: github.event_name == 'release'
shell: bash
run: |
echo "TRAVIS_TAG=${{github.event.release.tag_name}}" >> $GITHUB_ENV
python3 tools/update-contributors.py || python tools/update-contributors.py
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=`pwd`/install -DCPACK_PACKAGE_FILE_NAME=${{env.RELEASE_FILE}} ${{matrix.cmake-args}}
# Problem matching
- if: runner.os != 'Windows'
uses: ammaraskar/gcc-problem-matcher@master
- if: runner.os == 'Windows'
uses: ammaraskar/msvc-problem-matcher@master
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
ccache --zero-stats || true
cmake --build . --config $BUILD_TYPE -j 2
ccache --show-stats || true
#- name: Test
# working-directory: ${{runner.workspace}}/build
# shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C $BUILD_TYPE
- name: Prepare Artifact
if: github.event_name != 'release'
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build . --config $BUILD_TYPE --target install
- name: Upload Artifact
if: github.event_name != 'release'
uses: actions/upload-artifact@v3
with:
name: ${{env.RELEASE_FILE}}
path: ${{runner.workspace}}/build/install
- name: Package Release
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
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
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