Skip to content

Commit

Permalink
ci: add meson support
Browse files Browse the repository at this point in the history
  • Loading branch information
mochaaP committed Sep 19, 2024
1 parent b09b376 commit 7556690
Showing 1 changed file with 110 additions and 19 deletions.
129 changes: 110 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ on:
types: [opened, synchronize, reopened]

jobs:
build-linux:
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
build-linux-cmake:
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }}) with cmake
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
platform:
platform:
- { name: x86, flags: "-m32" }
- { name: x64, flags: "-m64" }
compiler:
- { name: GNU, CC: gcc }
- { name: LLVM, CC: clang }
flavor:
- { name: GNU, CC: gcc, CXX: g++ }
- { name: LLVM, CC: clang, CXX: clang++ }
flavor:
- Debug
- Release
mode:
- { name: default, args: "" }
mode:
- { name: default, args: "" }
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }

steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

- if: matrix.platform.name == 'x86'
name: Bootstrap
Expand All @@ -47,40 +47,131 @@ jobs:
mkdir build
cd build
cmake -DCMAKE_C_FLAGS=${{ matrix.platform.flags }} -DCMAKE_CXX_FLAGS=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..
- name: Build
run: |
cmake --build build --config ${{ matrix.flavor }}
build-windows:
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }})
build-linux-meson:
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }}) with meson
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
platform:
- { name: x86, flags: "-m32" }
- { name: x64, flags: "-m64" }
compiler:
- { name: GNU, CC: gcc, CXX: g++ }
- { name: LLVM, CC: clang, CXX: clang++ }
flavor:
- debug
- release
mode:
- { name: default, args: -Dtests=enabled }
- { name: NO_LIBC, args: -Dnolibc=true }

steps:
- name: Setup meson
run: |
pipx install meson
- name: Checkout
uses: actions/checkout@v4

- if: matrix.platform.name == 'x86'
name: Bootstrap
run: |
sudo dpkg --add-architecture i386
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get install -y g++-multilib g++
- name: Configure
env:
CC: ${{ matrix.compiler.CC }}
CXX: ${{ matrix.compiler.CXX }}
run: |
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }} -Dc_extra_args="${{ matrix.platform.flags }}" -Dcpp_extra_args="${{ matrix.platform.flags }}"
- name: Build
run: |
meson compile -C build-${{ matrix.flavor }}
- name: Run tests
run: |
meson test -C build-${{ matrix.flavor }}
build-windows-cmake:
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }}) with cmake
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
platform:
platform:
- { name: x86, flags: "Win32" }
- { name: x64, flags: "x64" }
- { name: x64, flags: "x64" }
compiler:
- { name: MSVC }
flavor:
flavor:
- Debug
- Release
mode:
- { name: default, args: "" }
mode:
- { name: default, args: "" }
- { name: NO_LIBC, args: -DZYAN_NO_LIBC=ON }

steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v4

- name: Configure
run: |
mkdir build
cd build
cmake -DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform.flags }} -DZYAN_DEV_MODE=ON ${{ matrix.mode.args }} ..
- name: Build
run: |
cmake --build build --config ${{ matrix.flavor }}
build-windows-meson:
name: Build ${{ matrix.platform.name }} ${{ matrix.compiler.name }} ${{ matrix.flavor }} (${{ matrix.mode.name }}) with meson
runs-on: windows-latest

strategy:
fail-fast: false
matrix:
platform:
- { name: x86, flags: "amd64_x86" }
- { name: x64, flags: "amd64" }
compiler:
- { name: MSVC }
flavor:
- debug
- release
mode:
- { name: default, args: -Dtests=enabled }
- { name: NO_LIBC, args: -Dnolibc=true }

steps:
- name: Setup meson
run: |
pipx install meson
- name: Checkout
uses: actions/checkout@v4

- name: Configure
run: |
$VCPATH = vswhere -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -latest
& '$VCPATH\VC\Auxiliary\Build\vcvarsall.bat' ${{ matrix.platform.flags }}
meson setup build-${{ matrix.flavor }} --buildtype=${{ matrix.flavor }} ${{ matrix.mode.args }}
- name: Build
run: |
meson compile -C build-${{ matrix.flavor }}
- name: Run tests
run: |
meson test -C build-${{ matrix.flavor }}

0 comments on commit 7556690

Please sign in to comment.