Files
cglm/.github/workflows/ci.yml
Recep Aslantas eb37a28ff5 Update ci.yml
2025-01-23 00:58:02 +03:00

389 lines
12 KiB
YAML

name: CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build_autotools:
name: Autotools / ${{ matrix.os }} / ${{ matrix.simd }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, ubuntu-22.04, ubuntu-24.04]
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- name: Install Autotools on macOS
if: runner.os == 'macOS'
run: brew upgrade && brew install autoconf automake libtool
- name: Install Autotools on Ubuntu
if: matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04'
run: sudo apt-get install -y autoconf automake libtool
- name: Set SIMD flags
run: |
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi
- name: Generate Autotools
run: ./autogen.sh
- name: Configure Autotools
run: ./configure CFLAGS="$CFLAGS"
- name: Build
run: make
- name: Test
run: make check
build_cmake_ios:
name: CMake / iOS
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: |
cmake \
-B build \
-GXcode \
-DCMAKE_SYSTEM_NAME=iOS \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO \
-DCGLM_STATIC=ON \
-DCGLM_USE_TEST=ON
- name: Build
run: cmake --build build
build_cmake_ubuntu:
name: CMake / ${{ matrix.target.os }} / ${{ matrix.target.cc }} / ${{ matrix.simd }}
runs-on: ${{ matrix.target.os }}
strategy:
fail-fast: false
matrix:
target:
- { os: ubuntu-20.04, cc: gcc-11 }
- { os: ubuntu-22.04, cc: gcc-12 }
- { os: ubuntu-24.04, cc: gcc-13 }
- { os: ubuntu-20.04, cc: clang-12 }
- { os: ubuntu-22.04, cc: clang-15 }
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- name: Add Ubuntu Toolchain PPA
if: matrix.target.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
- name: Install Compiler and Ninja
run: |
sudo apt-get install -y ${{ matrix.target.cc }} ninja-build
- name: Set SIMD flags
run: |
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi
- name: Configure CMake
run: cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.target.cc }} -DCMAKE_C_FLAGS="$CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
- name: Build
run: cmake --build build
- name: Test
working-directory: build
run: ./tests
build_cmake_macos:
name: CMake / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14]
steps:
- uses: actions/checkout@v4
- name: Install Ninja
if: runner.os == 'macOS'
run: brew upgrade && brew install ninja
- name: Configure CMake
run: |
cmake \
-B build \
-GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DCGLM_STATIC=ON \
-DCGLM_USE_TEST=ON
- name: Build
run: cmake --build build
- name: Test
working-directory: build
run: ./tests
build_cmake:
name: CMake / ${{ matrix.os }} / ${{ matrix.simd }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, windows-2022]
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- name: Install Ninja on macOS
if: runner.os == 'macOS'
run: brew upgrade && brew install ninja
- name: Set SIMD flags
run: |
if ($Env:RUNNER_OS -eq 'Windows') {
if ($Env:SIMD -eq 'none') {
$Env:CFLAGS=""
} elseif ($Env:SIMD -eq 'sse') {
$Env:CFLAGS="-arch:SSE"
} elseif ($Env:SIMD -eq 'sse2') {
$Env:CFLAGS="-arch:SSE2"
} elseif ($Env:SIMD -eq 'sse3') {
$Env:CFLAGS="-arch:SSE3"
} elseif ($Env:SIMD -eq 'sse4') {
$Env:CFLAGS="-arch:SSE4"
} elseif ($Env:SIMD -eq 'avx') {
$Env:CFLAGS="-arch:AVX"
} elseif ($Env:SIMD -eq 'avx2') {
$Env:CFLAGS="-arch:AVX2"
} elseif ($Env:SIMD -eq 'neon') {
$Env:CFLAGS="-arch:NEON"
}
} else {
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi
}
- name: Configure CMake
run: |
if ($Env:RUNNER_OS -eq 'Windows') {
cmake -B build -G "Visual Studio 17 2022" -A x64 -T host=x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="$Env:CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
} else {
cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="$CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
}
- name: Build
run: cmake --build build
- name: Test
working-directory: build
run: ./tests
build_meson:
name: Meson / ${{ matrix.os }} / ${{ matrix.simd }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-14, ubuntu-22.04, ubuntu-24.04, windows-2022]
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
- name: Install meson
run: python3 -m pip install meson ninja
- name: Set SIMD flags
run: |
if ($Env:RUNNER_OS -eq 'Windows') {
if ($Env:SIMD -eq 'none') {
$Env:CFLAGS=""
} elseif ($Env:SIMD -eq 'sse') {
$Env:CFLAGS="-arch:SSE"
} elseif ($Env:SIMD -eq 'sse2') {
$Env:CFLAGS="-arch:SSE2"
} elseif ($Env:SIMD -eq 'sse3') {
$Env:CFLAGS="-arch:SSE3"
} elseif ($Env:SIMD -eq 'sse4') {
$Env:CFLAGS="-arch:SSE4"
} elseif ($Env:SIMD -eq 'avx') {
$Env:CFLAGS="-arch:AVX"
} elseif ($Env:SIMD -eq 'avx2') {
$Env:CFLAGS="-arch:AVX2"
} elseif ($Env:SIMD -eq 'neon') {
$Env:CFLAGS="-arch:NEON"
}
} else {
if [ "${{ matrix.simd }}" == "none" ]; then
export CFLAGS=""
elif [ "${{ matrix.simd }}" == "sse" ]; then
export CFLAGS="-msse"
elif [ "${{ matrix.simd }}" == "sse2" ]; then
export CFLAGS="-msse2"
elif [ "${{ matrix.simd }}" == "sse3" ]; then
export CFLAGS="-msse3"
elif [ "${{ matrix.simd }}" == "sse4" ]; then
export CFLAGS="-msse4"
elif [ "${{ matrix.simd }}" == "avx" ]; then
export CFLAGS="-mavx"
elif [ "${{ matrix.simd }}" == "avx2" ]; then
export CFLAGS="-mavx2"
elif [ "${{ matrix.simd }}" == "neon" ]; then
export CFLAGS="-mfpu=neon"
fi
}
- name: Build with meson
run: |
meson setup build -Dbuildtype=release --default-library=static -Dbuild_tests=true -Dc_args="$CFLAGS"
meson test -C build
build_msbuild:
name: MSBuild / Windows / ${{ matrix.simd }}
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Retarget solution
run: |
vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
$vsInstallPath = vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
& "$vsInstallPath\Common7\IDE\devenv.com" cglm.sln /Upgrade
- name: Set SIMD flags
run: |
if ($Env:SIMD -eq 'none') {
$Env:CFLAGS=""
} elseif ($Env:SIMD -eq 'sse') {
$Env:CFLAGS="-arch:SSE"
} elseif ($Env:SIMD -eq 'sse2') {
$Env:CFLAGS="-arch:SSE2"
} elseif ($Env:SIMD -eq 'sse3') {
$Env:CFLAGS="-arch:SSE3"
} elseif ($Env:SIMD -eq 'sse4') {
$Env:CFLAGS="-arch:SSE4"
} elseif ($Env:SIMD -eq 'avx') {
$Env:CFLAGS="-arch:AVX"
} elseif ($Env:SIMD -eq 'avx2') {
$Env:CFLAGS="-arch:AVX2"
} elseif ($Env:SIMD -eq 'neon') {
$Env:CFLAGS="-arch:NEON"
}
- name: Build (x86)
working-directory: win
run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS"
- name: Build (x64)
working-directory: win
run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS"
build_documentation:
name: Documentation
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Dependencies
working-directory: docs
run: python3 -m pip install -r requirements.txt
- name: Build
working-directory: docs
run: sphinx-build -W --keep-going source build
build_swift:
name: Swift ${{ matrix.swift }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14, ubuntu-22.04]
# This has no test yet.
steps:
- uses: actions/checkout@v4
- name: Build
run: swift build