Spruce up shader compilation webpage #841
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: Build CF | |
# This workflow will work for pushes, pull requests, or a manual trigger (workflow_dispatch). | |
on: [push, pull_request, workflow_dispatch] | |
env: | |
CMAKE_BUILD_PARALLEL_LEVEL: 6 | |
jobs: | |
build: | |
# Matrix feature for cross-platform coverage. Names the build "Build X" | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
name: "Build ${{ matrix.platform.name }} (CF_RUNTIME_SHADER_COMPILATION=${{ matrix.runtime_shader_compilation.value }})" | |
runs-on: ${{ matrix.platform.os }} | |
timeout-minutes: 20 | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
# Don't cancel other in-progress jobs if one fails. | |
fail-fast: false | |
matrix: | |
runtime_shader_compilation: | |
- { value: 'ON', cmake_arg: '-DCF_RUNTIME_SHADER_COMPILATION=ON' } | |
- { value: 'OFF', cmake_arg: '-DCF_RUNTIME_SHADER_COMPILATION=OFF' } | |
platform: | |
# Diabled MinGW as it was having trouble with DX12 headers being out of date. | |
# - { name: "Windows (MinGW-w64)", os: windows-latest, artifact: 'mingw-w64', generate: '-G "MinGW Makefiles"' } | |
- { name: "Windows (MSCV 17 2022)", os: windows-latest, artifact: 'mscv17', generate: '-G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release' } | |
- { name: "MacOS", os: macos-latest, artifact: 'macos', generate: '-G "Unix Makefiles"' } | |
- { name: "Linux", os: ubuntu-latest, artifact: 'linux', generate: '-G "Unix Makefiles"' } | |
# TODO - Add iOS and Android platforms. Waiting on better support from GitHub. | |
steps: | |
- uses: actions/checkout@master | |
# Linux needs to install various dependencies. | |
# This could potentially be removed by using SOKOL_EXTERNAL_GL_LOADER. | |
- name: Install OpenGL + Audio | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install gcc-multilib | |
sudo apt-get install libasound2-dev libpulse-dev | |
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev | |
if: matrix.platform.name == 'Linux' | |
- name: Create build folder with CMake | |
run: | | |
cmake ${{ matrix.platform.generate }} ${{ matrix.runtime_shader_compilation.cmake_arg }} -B build_folder | |
- name: Build project binary (non-MSVC) | |
run: | | |
cmake --build build_folder | |
if: matrix.platform.name != 'Windows (MSCV 17 2022)' | |
# Default for MSVC is to build with Debug, so a special case is needed to produce | |
# Release binaries. | |
- name: Build project binary (MSVC) | |
run: | | |
cmake --build build_folder --config Release | |
if: matrix.platform.name == 'Windows (MSCV 17 2022)' | |
# Run tests for MSVC 17 | |
- name: Run Tests for MSVC 17 | |
shell: cmd | |
run: | | |
cd build_folder\Release | |
tests.exe | |
cd ..\.. | |
if: matrix.platform.name == 'Windows (MSCV 17 2022)' | |
# Run tests for MinGW (no Release folder) | |
- name: Run Tests for MinGW | |
shell: cmd | |
run: | | |
cd build_folder | |
tests.exe | |
docsparser.exe | |
cd .. | |
if: matrix.platform.name == 'Windows (MinGW)' | |
- name: Run Tests for Apple | |
run: | | |
cd build_folder | |
./tests | |
./docsparser | |
cd .. | |
if: runner.os == 'macOS' | |
- name: Run Tests for Linux | |
run: | | |
cd build_folder | |
./tests | |
./docsparser | |
cd .. | |
if: runner.os == 'Linux' | |
# Just call robocopy twice, one looking for libcute.a for MinGW, and one | |
# looking for cute.lib for MSCV. robocopy doesn't trigger a build failure for | |
# not finding a file. | |
- name: Generate artifacts for Windows | |
shell: cmd | |
run: | | |
robocopy include dist *.h | |
robocopy build_folder\Release dist cute.lib | |
robocopy build_folder dist libcute.a | |
7z a ${{ matrix.platform.artifact }}.zip .\dist\* | |
if: runner.os == 'Windows' | |
- name: Generate artifacts for MacOS | |
run: | | |
mkdir -p ./dist | |
cp -v ./include/*.h ./dist | |
cp -R -v ./build_folder/libcute.a ./dist | |
tar -czvf ${{ matrix.platform.artifact }}.tar.gz -C dist . | |
if: runner.os == 'macOS' | |
- name: Generate artifacts for Linux | |
run: | | |
mkdir -p ./dist | |
cp -v ./include/*.h ./dist | |
cp -v ./build_folder/libcute.a ./dist | |
tar -czvf ${{ matrix.platform.artifact }}.tar.gz -C dist . | |
if: runner.os == 'Linux' | |
# Uploads the zip archives onto the workflow. They can be downloaded for 90 days (by default). | |
# Find them here: https://github.com/RandyGaul/cute_framework/actions | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: ${{ matrix.platform.artifact }} | |
path: ./dist/ | |
if: matrix.runtime_shader_compilation.value == 'ON' |