Add GitHub Actions build workflows

This commit is contained in:
Kai Blaschke 2024-02-18 13:55:01 +01:00 committed by Kai Blaschke
parent e2251a0e8b
commit ef82ae3aeb
No known key found for this signature in database
GPG Key ID: B014B6811527389F
8 changed files with 212 additions and 2 deletions

51
.github/workflows/build_linux.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Ubuntu Linux
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
name: OpenStarbound Linux x86_64
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 libglew-dev libvorbis-dev libogg-dev libz3-dev libpng-dev libfreetype-dev libgtest-dev libgmock-dev ninja-build
- name: Configure Test Build
run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Debug
- name: Build Debug
run: cmake --build "${{ github.workspace }}/cmake-build-debug" --parallel
- name: Run Unit Tests
run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose
- name: Cleanup Test Build
run: rm -Rf "${{ github.workspace }}/cmake-build-debug" "${{ github.workspace }}/dist"
- name: Configure Release Build
run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=NO -DCMAKE_BUILD_TYPE=Release
- name: Build Release
run: cmake --build "${{ github.workspace }}/cmake-build-release" --parallel
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Dev-Linux-x86_64
path: dist/*

85
.github/workflows/build_macos.yml vendored Normal file
View File

@ -0,0 +1,85 @@
name: macOS
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
jobs:
build-intel:
name: OpenStarbound macOS x86_64
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install Packages
run: brew install sdl2 glew libvorbis lzlib libpng freetype ninja
- name: Configure Test Build
run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Debug
- name: Build Debug
run: cmake --build "${{ github.workspace }}/cmake-build-debug" --parallel
- name: Run Unit Tests
run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose
- name: Cleanup Test Build
run: rm -Rf "${{ github.workspace }}/cmake-build-debug" "${{ github.workspace }}/dist"
- name: Configure Release Build
run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=NO -DCMAKE_BUILD_TYPE=Release
- name: Build Release
run: cmake --build "${{ github.workspace }}/cmake-build-release" --parallel
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Dev-macOS-Intel
path: dist/*
build-arm:
name: OpenStarbound macOS arm64
runs-on: macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install Packages
run: brew install sdl2 glew libvorbis lzlib libpng freetype ninja
- name: Configure Test Build
run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Debug
- name: Build Debug
run: cmake --build "${{ github.workspace }}/cmake-build-debug" --config "Debug" --parallel
- name: Run Unit Tests
run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose --build-config "Debug"
- name: Cleanup Test Build
run: rm -Rf "${{ github.workspace }}/cmake-build-debug" "${{ github.workspace }}/dist"
- name: Configure Release Build
run: cmake -G "Ninja" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES -DCMAKE_BUILD_TYPE=Release
- name: Build Release
run: cmake --build "${{ github.workspace }}/cmake-build-release" --parallel
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Dev-macOS-Silicon
path: dist/*

48
.github/workflows/build_windows.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Windows
on:
push:
branches:
- "*"
tags:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
name: OpenStarbound Windows x86_64
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Configure Test Build
run: cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-debug" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES
- name: Build Debug
run: cmake --build "${{ github.workspace }}/cmake-build-debug" --config "Debug" --parallel
- name: Run Unit Tests
run: ctest --test-dir "${{ github.workspace }}/cmake-build-debug" -L 'NoAssets' --verbose --build-config "Debug"
- name: Cleanup Test Build
run: |
Remove-Item "${{ github.workspace }}\cmake-build-debug" -Recurse
Remove-Item "${{ github.workspace }}\dist" -Recurse
- name: Configure Release Build
run: cmake -G "Visual Studio 17 2022" -A "X64" -S "${{ github.workspace }}/source" -B "${{ github.workspace }}/cmake-build-release" -DCMAKE_TOOLCHAIN_FILE="${Env:VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" -DCMAKE_VERBOSE_MAKEFILE=YES -DBUILD_TESTING=YES
- name: Build Release
run: cmake --build "${{ github.workspace }}/cmake-build-release" --config "Release" --parallel
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: OpenStarbound-Dev-Windows-x64
path: dist/*

View File

@ -509,8 +509,11 @@ SET (STAR_GAME_INCLUDES
ADD_SUBDIRECTORY (game) ADD_SUBDIRECTORY (game)
# Googletest based tests # Googletest based tests
ENABLE_TESTING() OPTION (BUILD_TESTING "Build test projects" OFF)
ADD_SUBDIRECTORY (test) IF (BUILD_TESTING)
ENABLE_TESTING()
ADD_SUBDIRECTORY (test)
ENDIF()
# Starbound stand-alone server. # Starbound stand-alone server.
ADD_SUBDIRECTORY (server) ADD_SUBDIRECTORY (server)

View File

@ -9,6 +9,7 @@ SET (OPUS_FLOAT_APPROX ON)
SET (OPUS_STACK_PROTECTOR OFF) SET (OPUS_STACK_PROTECTOR OFF)
SET (OPUS_NONTHREADSAFE_PSEUDOSTACK OFF) SET (OPUS_NONTHREADSAFE_PSEUDOSTACK OFF)
SET (OPUS_USE_ALLOCA ON) SET (OPUS_USE_ALLOCA ON)
SET (BUILD_TESTING OFF) # Skip Opus tests, these won't build because the tests don't honor OPUS_FLOAT_APPROX.
ADD_SUBDIRECTORY (opus) ADD_SUBDIRECTORY (opus)
IF (OPUS_NONTHREADSAFE_PSEUDOSTACK) IF (OPUS_NONTHREADSAFE_PSEUDOSTACK)

View File

@ -83,3 +83,6 @@ ADD_EXECUTABLE (game_tests
${star_game_tests_SOURCES}) ${star_game_tests_SOURCES})
TARGET_LINK_LIBRARIES (game_tests ${STAR_EXT_LIBS}) TARGET_LINK_LIBRARIES (game_tests ${STAR_EXT_LIBS})
ADD_TEST (NAME game_tests WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/game_tests) ADD_TEST (NAME game_tests WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/game_tests)
SET_TESTS_PROPERTIES(core_tests PROPERTIES
LABELS "NoAssets")

View File

@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json",
"default-registry": {
"kind": "git",
"baseline": "638b1588be3a265a9c7ad5b212cef72a1cad336a",
"repository": "https://github.com/microsoft/vcpkg"
}
}

11
source/vcpkg.json Normal file
View File

@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"dependencies": [
"glew",
"sdl2",
"libvorbis",
"zlib",
"freetype",
"libpng"
]
}