ci: add arm64 windows runner + MSYS2 clang + clangarm64 #410
This file contains hidden or 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 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: | |
config: | |
- name: Windows MSVC (dynamic) | |
os: windows | |
os-version: 2025 | |
environment: msvc | |
shell: pwsh | |
static: false | |
fatal_warnings: false # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers | |
- name: Windows MSVC (static) | |
os: windows | |
os-version: 2025 | |
environment: msvc | |
shell: pwsh | |
static: true | |
fatal_warnings: false # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers | |
- name: Windows MSVC (ARM64, static) | |
os: windows | |
os-version: 11-arm | |
environment: msvc | |
shell: pwsh | |
static: true | |
fatal_warnings: false # TODO: enable fatal warnings, once cpp-httplib is patched either by ourselves or by the maintainers | |
- name: Windows MSYS2 (MingGW) | |
os: windows | |
os-version: 2025 | |
environment: msys2 | |
msystem: MINGW64 | |
architecture: x86_64 | |
use-clang: false | |
shell: 'msys2 {0}' | |
fatal_warnings: true | |
- name: Windows MSYS2 (UCRT) | |
os: windows | |
os-version: 2025 | |
environment: msys2 | |
msystem: UCRT64 | |
architecture: ucrt-x86_64 | |
use-clang: false | |
shell: 'msys2 {0}' | |
fatal_warnings: true | |
- name: Windows MSYS2 (CLANG) | |
os: windows | |
os-version: 2025 | |
environment: msys2 | |
msystem: CLANG64 | |
architecture: clang-x86_64 | |
use-clang: true | |
shell: 'msys2 {0}' | |
fatal_warnings: true | |
- name: Windows MSYS2 (ARM64, CLANG) | |
os: windows | |
os-version: 11-arm | |
environment: msys2 | |
msystem: CLANGARM64 | |
architecture: clang-x86_64 | |
use-clang: true | |
shell: 'msys2 {0}' | |
fatal_warnings: true | |
- name: Linux (ARM64) | |
os: ubuntu | |
os-version: 24.04-arm | |
use-clang: false | |
shell: bash | |
fatal_warnings: true | |
- name: Linux | |
os: ubuntu | |
os-version: 24.04 | |
use-clang: false | |
shell: bash | |
fatal_warnings: true | |
- name: Linux Clang (libstdc++) | |
os: ubuntu | |
os-version: 24.04 | |
use-clang: true | |
use-clang_stdlib: false | |
shell: bash | |
fatal_warnings: true | |
- name: Linux Clang (libc++) | |
os: ubuntu | |
os-version: 24.04 | |
use-clang: true | |
use-clang_stdlib: true | |
shell: bash | |
fatal_warnings: true | |
- name: Linux Clang (libc++, ARM64) | |
os: ubuntu | |
os-version: 24.04-arm | |
use-clang: true | |
use-clang_stdlib: true | |
shell: bash | |
fatal_warnings: true | |
- name: MacOS | |
os: macos | |
os-version: 13 | |
shell: bash | |
fatal_warnings: true | |
- name: MacOS (Arm64) | |
os: macos | |
os-version: 15 | |
shell: bash | |
fatal_warnings: true | |
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.environment == 'msvc' | |
uses: TheMrMilchmann/setup-msvc-dev@v3 | |
with: | |
arch: ${{matrix.config.os-version == '11-arm' && 'x64' || 'x64'}} # TODO:fix this action: note this action doesn't really support arm64 yet, but it works like this already (by accident) | |
toolset: '14.43' | |
- name: Setup MSYS2 (Windows) | |
if: matrix.config.os == 'windows' && matrix.config.environment == 'msys2' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{matrix.config.msystem}} | |
update: true | |
install: >- | |
mingw-w64-${{matrix.config.architecture}}-ninja | |
mingw-w64-${{matrix.config.architecture}}-python | |
mingw-w64-${{matrix.config.architecture}}-python-pip | |
mingw-w64-${{matrix.config.architecture}}-SDL2 | |
mingw-w64-${{matrix.config.architecture}}-SDL2_ttf | |
mingw-w64-${{matrix.config.architecture}}-SDL2_mixer | |
mingw-w64-${{matrix.config.architecture}}-SDL2_image | |
mingw-w64-${{matrix.config.architecture}}-pkg-config | |
mingw-w64-${{matrix.config.architecture}}-ca-certificates | |
mingw-w64-${{matrix.config.architecture}}-cmake | |
git | |
- name: Setup GCC (MSYS2) | |
if: matrix.config.os == 'windows' && matrix.config.environment == 'msys2' && matrix.config.use-clang == false | |
uses: Totto16/msys2-install-packages-pinned@a6a188c9c2e3eb2feb8b1a3c910f61d1ee05aa7b | |
with: | |
msystem: ${{matrix.config.msystem}} | |
# gcc-libs 14 don't provide the virtual package cc-libs, only gcc-libs 15 (see https://github.com/msys2/MINGW-packages/commit/9fa882f7eb6f639780a13df016497a93e45544ac) provide it, so until we use gcc 15, nghttp3 < 1.10.1 needs to be used (see https://github.com/msys2/MINGW-packages/commit/16b7f94772f29f1c207764701d863d266a5de64c) since 1.10.1 needs cc-libs and not gcc-libs. The newest version matching that constraint is 1.9.0 | |
# for the other pavckages see https://github.com/msys2/MINGW-packages/commit/62308009e77d772a126313626b194e503b0e5135 | |
install: | | |
nghttp3=1.9 | |
SDL2=2.32.4 | |
aom=3.12.0 | |
curl=8.13.0 | |
gnutls=3.8.8 | |
libarchive=3.7.9 | |
mpg123=1.32.9 | |
ngtcp2=1.12.0 | |
python=3.12.9-4 | |
gcc=14 gcc-libs=! | |
- name: Setup Clang (MSYS2, libc++) | |
if: matrix.config.os == 'windows' && matrix.config.environment == 'msys2' && matrix.config.use-clang == true | |
uses: Totto16/msys2-install-packages-pinned@a6a188c9c2e3eb2feb8b1a3c910f61d1ee05aa7b | |
with: | |
msystem: ${{matrix.config.msystem}} | |
install: | | |
clang=20 | |
libc++=20 | |
- name: Setup Clang (Linux, libc++) | |
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 20 | |
sudo apt-get install libc++-20* libc++abi*20* -y --no-install-recommends | |
echo "CC=clang-20" >> "$GITHUB_ENV" | |
echo "CXX=clang++-20" >> "$GITHUB_ENV" | |
echo "OBJC=clang-20" >> "$GITHUB_ENV" | |
- name: Setup Clang (Linux, libstdc++) | |
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && (! matrix.config.use-clang_stdlib) | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 20 | |
echo "CC=clang-20" >> "$GITHUB_ENV" | |
echo "CXX=clang++-20" >> "$GITHUB_ENV" | |
echo "OBJC=clang-20" >> "$GITHUB_ENV" | |
- name: Setup GCC (Linux) | |
if: matrix.config.os == 'ubuntu' && matrix.config.use-clang == false | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: 14 | |
platform: ${{matrix.config.os-version == '24.04-arm' && 'x64' || 'x64'}} # TODO:fix this action: note this action doesn't really support arm64 yet, but it works like this already (by accident) | |
- name: Unbreak Python in GHA (MacOS 13 image) | |
if: matrix.config.os == 'macos' && matrix.config.os-version == 13 | |
run: | | |
# TODO: remove this, after it works again | |
# A workaround for "The `brew link` step did not complete successfully" error. | |
# See e.g. 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 Clang (MacOS) | |
if: matrix.config.os == 'macos' | |
run: | | |
brew update | |
brew install llvm@20 lld@20 | |
echo "$(brew --prefix)/opt/llvm@20/bin:$(brew --prefix)/opt/lld@20/bin" >> $GITHUB_PATH | |
echo "LDFLAGS=-L$(brew --prefix)/opt/llvm@20/lib -L$(brew --prefix)/opt/llvm@20/lib/c++ -Wl,-rpath,$(brew --prefix)/opt/llvm@20/lib/c++ -L$(brew --prefix)/opt/lld@20/lib" >> "$GITHUB_ENV" | |
echo "CPPFLAGS=-I$(brew --prefix)/opt/llvm@20/include -I$(brew --prefix)/opt/lld@20/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: Setup meson (MacOS) | |
if: matrix.config.os == 'macos' | |
run: | | |
brew update | |
brew install meson | |
# NOTE: meson has no dependencies, so --break-system-packages doesn't really break anything! | |
- name: Setup meson | |
if: matrix.config.os != 'macos' | |
run: | | |
pip install meson --break-system-packages | |
- 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 --no-install-recommends | |
- name: Install dependencies (MacOS) | |
if: matrix.config.os == 'macos' | |
run: | | |
brew update | |
brew install sdl2 sdl2_ttf sdl2_mixer sdl2_image | |
- name: Configure | |
run: meson setup build -Dbuildtype=release -Ddefault_library=${{( matrix.config.os == 'windows' && matrix.config.environment == 'msvc' && matrix.config.static ) && 'static' ||'shared' }} -Dclang_libcpp=${{ ( ( matrix.config.os == 'ubuntu' && matrix.config.use-clang == true && matrix.config.use-clang_stdlib ) || matrix.config.os == 'macos' || ( matrix.config.os == 'windows' && matrix.config.environment == 'msys2' && matrix.config.use-clang == true ) ) && 'enabled' || 'disabled' }} -Drun_in_ci=true ${{( matrix.config.fatal_warnings ) && '--fatal-meson-warnings' || '' }} | |
- name: Build | |
run: meson compile -C build | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.name }} Executable | |
path: build/src/executables/oopetris* |