Skip to content

Merge pull request #138 from mgerhold/color-picker #71

Merge pull request #138 from mgerhold/color-picker

Merge pull request #138 from mgerhold/color-picker #71

Workflow file for this run

name: Meson CI
on:
push:
branches: ["main"]
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}-${{ matrix.config.os-version }}
strategy:
fail-fast: false
matrix:
# Customize the Meson build type here ("plain", "debug", "debugoptimized", "release", "minsize", "custom".)
config:
- name: Windows MSVC Release
os: windows
os-version: 2022
msvc: true
buildtype: release
library_type: static
shell: pwsh
- name: Windows MingGW Release
os: windows
os-version: 2022
msvc: false
buildtype: release
library_type: static
shell: "msys2 {0}"
- name: Linux Release
os: ubuntu
os-version: 22.04
buildtype: release
use-clang: false
library_type: shared
shell: bash
- name: Linux Clang Release (libstdc++)
os: ubuntu
os-version: 22.04
buildtype: release
use-clang: true
use-clang_stdlib: false
library_type: shared
shell: bash
- name: Linux Clang Release (libc++)
os: ubuntu
os-version: 22.04
buildtype: release
use-clang: true
use-clang_stdlib: true
library_type: shared
shell: bash
- name: MacOS Release
os: macos
os-version: 13
arm: false
buildtype: release
library_type: shared
shell: bash
- name: MacOS Release (Arm64)
os: macos
os-version: 14
arm: true
buildtype: release
library_type: shared
shell: bash
defaults:
run:
shell: ${{ matrix.config.shell }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Setup MSVC (Windows)
if: matrix.config.os == 'windows' && matrix.config.msvc == true
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64
toolset: 14.39
- name: Setup MinGW (Windows)
if: matrix.config.os == 'windows' && matrix.config.msvc == false
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja mingw-w64-x86_64-python mingw-w64-x86_64-python-pip mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-pkg-config mingw-w64-x86_64-ca-certificates mingw-w64-x86_64-cmake git
- name: Setup Clang (Linux)
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
sudo apt-get install libc++-17* libc++abi*17* -y
echo "CC=clang-17" >> "$GITHUB_ENV"
echo "CXX=clang++-17" >> "$GITHUB_ENV"
echo "OBJC=clang-17" >> "$GITHUB_ENV"
- name: Setup GCC (Linux)
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == false
uses: egor-tensin/setup-gcc@v1
with:
version: 13
platform: x64
- name: Setup Clang (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install llvm@17
echo "$(brew --prefix)/opt/llvm/bin" >> $GITHUB_PATH
echo "LDFLAGS=-L$(brew --prefix)/opt/llvm/lib -L$(brew --prefix)/opt/llvm/lib/c++ -Wl,-rpath,$(brew --prefix)/opt/llvm/lib/c++" >> "$GITHUB_ENV"
echo "CPPFLAGS=-I$(brew --prefix)/opt/llvm/include" >> "$GITHUB_ENV"
echo "CC=clang" >> "$GITHUB_ENV"
echo "CXX=clang++" >> "$GITHUB_ENV"
echo "OBJC=clang" >> "$GITHUB_ENV"
echo "CC_LD=lld" >> "$GITHUB_ENV"
echo "CXX_LD=lld" >> "$GITHUB_ENV"
echo "OBJC_LD=lld" >> "$GITHUB_ENV"
- name: Unbreak Python in GHA for 3.11 (MacOS 13 image)
if: matrix.config.os == 'macos' && matrix.config.os-version == 13
run: |
# A workaround for "The `brew link` step did not complete successfully" error.
# See https://github.com/Homebrew/homebrew-core/issues/165793#issuecomment-1991817938
find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
sudo rm -rf /Library/Frameworks/Python.framework/
brew install --force python3 && brew unlink python3 && brew unlink python3 && brew link --overwrite python3
- name: Setup meson (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install meson
- name: Setup meson
if: matrix.config.os != 'macos'
run: |
python -m pip install --upgrade pip
pip install meson
- name: Install dependencies (Linux)
if: matrix.config.os == 'ubuntu'
run: |
sudo apt-get update
sudo apt-get install ninja-build libsdl2-2.0-0 libsdl2-dev libsdl2-ttf* libsdl2-mixer* libsdl2-image* -y
- name: Install dependencies (MacOS)
if: matrix.config.os == 'macos'
run: |
brew update
brew install ninja sdl2 sdl2_ttf sdl2_mixer sdl2_image
- name: Configure
run: meson setup build -Dbuildtype=${{ matrix.config.buildtype }} -Ddefault_library=${{ matrix.config.library_type }} -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' ) && 'enabled' || 'disabled' }}
- name: Build
run: meson compile -C build
- name: Upload artifacts - Linux
uses: actions/upload-artifact@v4
if: matrix.config.os == 'ubuntu'
with:
name: ${{ matrix.config.name }} Executable
path: build/oopetris
- name: Upload artifacts - MacOS
uses: actions/upload-artifact@v4
if: matrix.config.os == 'macos'
with:
name: ${{ matrix.config.name }} Executable
path: build/oopetris
# TODO: create a proper installer: https://mesonbuild.com/Creating-OSX-packages.html
- name: Upload artifacts - Windows
uses: actions/upload-artifact@v4
if: matrix.config.os == 'windows'
with:
name: ${{ matrix.config.name }} Executable
path: build/oopetris.exe