Version 0.3.2 #1272
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/pico.toolchain -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 | |
- name: Checkout Examples | |
uses: actions/checkout@v3 | |
with: | |
repository: 32blit/32blit-examples | |
path: examples | |
# 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: Prepare Artifact | |
if: github.event_name != 'release' | |
shell: bash | |
run: | | |
cmake --build $RUNNER_WORKSPACE/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 |