Updated README #58
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 Build Matrix | |
on: | |
push: | |
branches: | |
- '*' | |
release: | |
types: [published] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: MinSizeRel | |
TARGET: supershader | |
TARGET_SOURCE_DIR: src | |
jobs: | |
build: | |
name: Build for ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows Latest MSVC", | |
os: windows-latest, | |
artifact: "windows_msvc", | |
cc: "cl", | |
cxx: "cl", | |
generators: "Visual Studio 17 2022" | |
} | |
- { | |
name: "Windows Latest MinGW", | |
os: windows-latest, | |
artifact: "windows_mingw", | |
cc: "gcc", | |
cxx: "g++", | |
generators: "Ninja" | |
} | |
- { | |
name: "Ubuntu Latest GCC", | |
os: ubuntu-latest, | |
artifact: "ubuntu_gcc", | |
cc: "gcc", | |
cxx: "g++", | |
generators: "Ninja" | |
} | |
- { | |
name: "macOS Latest Clang", | |
os: macos-latest, | |
artifact: "macos_clang", | |
cc: "clang", | |
cxx: "clang++", | |
generators: "Ninja" | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Print env | |
run: | | |
echo github.event.action: ${{ github.event.action }} | |
echo github.event_name: ${{ github.event_name }} | |
- name: Install dependencies on Windows | |
if: startsWith(matrix.config.os, 'windows') | |
run: | | |
choco install ninja cmake | |
ninja --version | |
cmake --version | |
- name: Install dependencies on Ubuntu | |
if: startsWith(matrix.config.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install ninja-build cmake | |
ninja --version | |
cmake --version | |
gcc --version | |
- name: Install dependencies on macOS | |
if: startsWith(matrix.config.os, 'macos') | |
run: | | |
brew install cmake ninja | |
ninja --version | |
cmake --version | |
- name: Update glslang sources (SPIRV-Tools) | |
working-directory: libs/glslang | |
run: | | |
python update_glslang_sources.py | |
- name: Configure | |
shell: bash | |
env: | |
CC: ${{ matrix.config.cc }} | |
CXX: ${{ matrix.config.cxx }} | |
run: | | |
mkdir build | |
mkdir instdir | |
cmake \ | |
-S . \ | |
-B build \ | |
-DSUPERSHADER_VERSION:STRING="\"${{ github.event.release.tag_name }}\"" \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-G "${{ matrix.config.generators }}" \ | |
-DCMAKE_INSTALL_PREFIX:PATH=instdir \ | |
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" | |
- name: Build | |
shell: bash | |
env: | |
CC: ${{ matrix.config.cc }} | |
CXX: ${{ matrix.config.cxx }} | |
run: cmake --build build --config ${{env.BUILD_TYPE}} --target ${{env.TARGET}} | |
- name: Install Strip | |
shell: bash | |
run: cmake --install build/${{env.TARGET_SOURCE_DIR}} --config ${{env.BUILD_TYPE}} --strip | |
- name: List directories | |
shell: bash | |
working-directory: instdir | |
run: ls -laR | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: ./instdir/bin/* | |
if-no-files-found: error | |
publish: | |
if: startsWith(github.ref, 'refs/tags/v') | |
name: Publish for ${{ matrix.config.name }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows", | |
artifact: "windows_msvc", | |
release: "windows" | |
} | |
- { | |
name: "Linux", | |
artifact: "ubuntu_gcc", | |
release: "linux" | |
} | |
- { | |
name: "macOS", | |
artifact: "macos_clang", | |
release: "macos" | |
} | |
needs: build | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.config.artifact }} | |
path: artifacts | |
- name: Add exec permission | |
shell: bash | |
working-directory: artifacts | |
run: chmod +x * | |
- name: Display structure of downloaded files | |
shell: bash | |
run: ls -laR | |
working-directory: artifacts | |
- name: Pack artifact | |
shell: bash | |
run: | | |
zip -j ${{env.TARGET}}_${{ matrix.config.release }}.zip artifacts/* | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ${{env.TARGET}}_${{ matrix.config.release }}.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |