mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-04 14:45:41 +00:00
111 lines
3.9 KiB
YAML
111 lines
3.9 KiB
YAML
name: Ubuntu Linux (x86_64)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "*"
|
|
tags:
|
|
- "*"
|
|
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
|
|
jobs:
|
|
build-shared:
|
|
name: Shared Library
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'recursive'
|
|
|
|
- name: Install Packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libgl1-mesa-dev mesa-common-dev libsdl2-dev libglm-dev libgtest-dev libgmock-dev ninja-build
|
|
|
|
- name: Configure Build
|
|
run: cmake -G "Ninja Multi-Config" -S "${{ github.workspace }}" -B "${{ github.workspace }}/cmake-build" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=YES
|
|
|
|
- name: Build Debug
|
|
run: cmake --build "${{ github.workspace }}/cmake-build" --config "Debug" --parallel
|
|
|
|
- name: Run Unit Tests
|
|
run: ctest --test-dir "${{ github.workspace }}/cmake-build" --verbose --build-config "Debug"
|
|
|
|
- name: Build Release
|
|
run: cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --parallel
|
|
|
|
- name: Install
|
|
run: |
|
|
cmake --build "${{ github.workspace }}/cmake-build" --config "Debug" --target install
|
|
cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --target install
|
|
|
|
- name: Check Installed Headers Compile Cleanly
|
|
run: |
|
|
mkdir -p header-check
|
|
cat <<EOF > header-check/CMakeLists.txt
|
|
cmake_minimum_required(VERSION 3.15)
|
|
project(HeaderCheck C)
|
|
|
|
set(PROJECTM_INCLUDE_DIR "${{ github.workspace }}/install/include")
|
|
file(GLOB_RECURSE PUBLIC_HEADERS "\${PROJECTM_INCLUDE_DIR}/*.h")
|
|
|
|
foreach(header IN LISTS PUBLIC_HEADERS)
|
|
file(RELATIVE_PATH header_rel "\${PROJECTM_INCLUDE_DIR}" "\${header}")
|
|
set(test_source "\${CMAKE_BINARY_DIR}/check_\${header_rel}.c")
|
|
file(WRITE "\${test_source}" "#include <\${header_rel}>\nint main(void){return 0;}\n")
|
|
add_executable("check_\${header_rel}" "\${test_source}")
|
|
target_include_directories("check_\${header_rel}" PRIVATE "\${PROJECTM_INCLUDE_DIR}")
|
|
endforeach()
|
|
EOF
|
|
|
|
cmake -S header-check -B header-check/build -DCMAKE_C_STANDARD=99
|
|
cmake --build header-check/build --parallel
|
|
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: projectm-linux-shared-latest
|
|
path: install/*
|
|
|
|
build-static:
|
|
name: Static Library
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: 'recursive'
|
|
|
|
- name: Install Packages
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libgl1-mesa-dev mesa-common-dev libsdl2-dev libglm-dev libgtest-dev libgmock-dev ninja-build
|
|
|
|
- name: Configure Build
|
|
run: cmake -G "Ninja Multi-Config" -S "${{ github.workspace }}" -B "${{ github.workspace }}/cmake-build" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTING=YES
|
|
|
|
- name: Build Debug
|
|
run: cmake --build "${{ github.workspace }}/cmake-build" --config "Debug" --parallel
|
|
|
|
- name: Run Unit Tests
|
|
run: ctest --test-dir "${{ github.workspace }}/cmake-build" --verbose --build-config "Debug"
|
|
|
|
- name: Build Release
|
|
run: cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --parallel
|
|
|
|
- name: Install
|
|
run: |
|
|
cmake --build "${{ github.workspace }}/cmake-build" --config "Debug" --target install
|
|
cmake --build "${{ github.workspace }}/cmake-build" --config "Release" --target install
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: projectm-linux-static-latest
|
|
path: install/*
|