Fix old #2578
This file contains 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 | |
on: | |
push: | |
branches: [ master ] | |
paths: [ src/**, test/**, cmake/**, .github/workflows/ci.yml, CMakeLists.txt ] | |
pull_request: | |
branches: [ master ] | |
paths: [ src/**, test/**, cmake/**, .github/workflows/ci.yml, CMakeLists.txt ] | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
env: | |
BUILD_TYPE: RelWithDebInfo | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' | |
jobs: | |
build-windows: | |
name: "windows-${{matrix.platform}}" | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ x64, x86 ] | |
steps: | |
- name: Update vcpkg | |
shell: pwsh | |
run: | | |
$vcpkgCommit = '16ee2ecb31788c336ace8bb14c21801efb6836e4' | |
pushd "$env:VCPKG_INSTALLATION_ROOT" | |
git fetch --depth=1 origin $vcpkgCommit | |
git reset --hard $vcpkgCommit | |
./bootstrap-vcpkg.bat | |
Get-ChildItem -Path 'triplets\*-windows*.cmake' | ForEach-Object { | |
Add-Content -Path $_ -Value 'set(VCPKG_BUILD_TYPE "release")' | |
} | |
popd | |
- name: Setup NuGet Credentials | |
shell: pwsh | |
run: | | |
$nugetCmd = vcpkg fetch nuget | Select-Object -Last 1 | |
$nugetSource = 'https://nuget.pkg.github.com/CelestiaProject/index.json' | |
& "$nugetCmd" sources add ` | |
-Source "$nugetSource" ` | |
-StorePasswordInClearText ` | |
-Name "GitHub" ` | |
-Username 'CelestiaProject' ` | |
-Password '${{secrets.GITHUB_TOKEN}}' | |
- name: Install dependencies | |
shell: pwsh | |
run: | | |
vcpkg --triplet=${{matrix.platform}}-windows install --recurse ` | |
cspice eigen3 ffmpeg[x264] fmt freetype gettext gperf libepoxy libjpeg-turbo libpng luajit ` | |
qtbase qt5compat[core] | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Configure CMake | |
shell: pwsh | |
run: | | |
if ( '${{matrix.platform}}' -eq 'x86' ) { | |
$GeneratorPlatform = 'Win32' | |
} else { | |
$GeneratorPlatform = '${{matrix.platform}}' | |
} | |
cmake -B '${{github.workspace}}/build' ` | |
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake" ` | |
-DVCPKG_TARGET_TRIPLET=${{matrix.platform}}-windows ` | |
-DCMAKE_GENERATOR_PLATFORM="$GeneratorPlatform" ` | |
-DENABLE_SPICE=ON ` | |
-DENABLE_TOOLS=ON ` | |
-DENABLE_TESTS=ON ` | |
-DENABLE_SDL=OFF ` | |
-DENABLE_QT5=OFF ` | |
-DENABLE_QT6=ON ` | |
-DENABLE_FFMPEG=ON ` | |
-DENABLE_MINIAUDIO=ON ` | |
-DENABLE_LTO=ON ` | |
-DUSE_ICU=ON ` | |
-DUSE_WIN_ICU=OFF | |
- name: Build | |
shell: pwsh | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} '--' /maxcpucount:2 /nologo | |
- name: Test | |
shell: pwsh | |
working-directory: ${{github.workspace}}/build | |
run: ctest -C ${{env.BUILD_TYPE}} | |
- name: Run winqtdeploy | |
shell: pwsh | |
working-directory: ${{github.workspace}}/build/src/celestia | |
run: | | |
& "$env:VCPKG_INSTALLATION_ROOT/installed/${{matrix.platform}}-windows/tools/Qt6/bin/windeployqt.exe" qt6\${{env.BUILD_TYPE}}\celestia-qt6.exe | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: celestia-windows-${{matrix.platform}} | |
path: | | |
${{github.workspace}}/build/src/**/*.exe | |
${{github.workspace}}/build/src/**/*.dll | |
${{github.workspace}}/build/po/**/*.gmo | |
${{github.workspace}}/build/tools/**/*.exe | |
${{github.workspace}}/shaders/*.glsl | |
build-posix: | |
name: "${{matrix.config.os}}" | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- os: ubuntu:18.04 | |
avif: OFF # Not supported on Ubuntu20.04 | |
gles: ON | |
gtk3: ON | |
minaudio: OFF | |
wayland: OFF | |
icu: ON | |
qt6: OFF | |
cspice: OFF | |
- os: ubuntu:latest | |
avif: ON | |
gles: ON | |
gtk3: ON | |
minaudio: ON | |
wayland: ON | |
icu: ON | |
qt6: ON | |
cspice: ON | |
analysis_artifacts: 1 | |
runs-on: ubuntu-latest | |
container: | |
image: "${{matrix.config.os}}" | |
steps: | |
- name: 'Install dependencies' | |
run: | | |
apt-get update | |
apt-get install -y libeigen3-dev \ | |
libepoxy-dev \ | |
libavcodec-dev \ | |
libavformat-dev \ | |
libavutil-dev \ | |
libswscale-dev \ | |
libjpeg-dev \ | |
libpng-dev \ | |
libglu1-mesa-dev \ | |
libgtk-3-dev \ | |
libfreetype6-dev \ | |
libsdl2-dev \ | |
libluajit-5.1-dev \ | |
libfmt-dev \ | |
libicu-dev \ | |
libwayland-dev \ | |
wayland-protocols \ | |
gettext \ | |
gperf \ | |
ninja-build \ | |
qtbase5-dev \ | |
qtbase5-dev-tools \ | |
qtbase5-private-dev \ | |
git \ | |
cmake \ | |
ninja-build \ | |
g++ \ | |
zip | |
if [ "${{matrix.config.qt6}}" = "ON" ]; then | |
apt-get install -y qt6-base-dev \ | |
qt6-base-dev-tools \ | |
libqt6core5compat6-dev \ | |
qt6-base-private-dev | |
fi | |
if [ "${{matrix.config.avif}}" = "ON" ]; then | |
apt-get install -y libavif-dev | |
fi | |
- name: 'Checkout source code' | |
run: | | |
git config --global --add safe.directory $(pwd) | |
git clone --depth=1 --recurse-submodules -j2 https://github.com/CelestiaProject/Celestia.git . | |
git checkout "$GITHUB_REF" | |
- name: 'Configure CMake' | |
working-directory: /__w/Celestia/Celestia | |
run: | | |
mkdir build | |
cd build | |
cmake -G Ninja \ | |
-DENABLE_GLES=${{matrix.config.gles}} \ | |
-DENABLE_SPICE=${{matrix.config.cspice}} \ | |
-DENABLE_TOOLS=OFF \ | |
-DENABLE_TESTS=ON \ | |
-DENABLE_SDL=ON \ | |
-DENABLE_GTK=ON \ | |
-DUSE_GTK3=${{matrix.config.gtk3}} \ | |
-DENABLE_QT5=ON \ | |
-DENABLE_QT6=${{matrix.config.qt6}} \ | |
-DUSE_WAYLAND=${{matrix.config.wayland}} \ | |
-DENABLE_FFMPEG=ON \ | |
-DENABLE_LIBAVIF=${{matrix.config.avif}} \ | |
-DENABLE_MINIAUDIO=${{matrix.config.minaudio}} \ | |
-DUSE_ICU=${{matrix.config.icu}} \ | |
.. | |
- name: Build | |
working-directory: /__w/Celestia/Celestia/build | |
run: ninja | |
- name: Test | |
working-directory: /__w/Celestia/Celestia/build | |
run: ctest | |
- name: 'Package autogenerated headers' | |
if: ${{ success() && matrix.config.analysis_artifacts }} | |
working-directory: /__w/Celestia/Celestia | |
shell: bash | |
run: | | |
shopt -s globstar | |
zip celestia-autogenerated-headers \ | |
build/src/**/*_autogen/**/*.h \ | |
build/src/**/*_autogen/**/*.inc | |
- name: 'Write PR details' | |
if: ${{ success() && github.event_name == 'pull_request' && matrix.config.analysis_artifacts }} | |
working-directory: /__w/Celestia/Celestia | |
run: | | |
printenv | |
echo "PR_KEY=${{ github.event.number }}" > pr-details.txt | |
echo "PR_BRANCH=${{ github.event.pull_request.head.ref }}" >> pr-details.txt | |
echo "PR_BASE=${{ github.event.pull_request.base.ref }}" >> pr-details.txt | |
- name: 'Upload autogenerated headers' | |
uses: actions/upload-artifact@v3 | |
if: ${{ success() && matrix.config.analysis_artifacts }} | |
with: | |
name: celestia-autogenerated-headers | |
path: celestia-autogenerated-headers.zip | |
- name: 'Upload PR details' | |
uses: actions/upload-artifact@v3 | |
if: ${{ success() && github.event_name == 'pull_request' && matrix.config.analysis_artifacts }} | |
with: | |
name: pr-details | |
path: pr-details.txt | |
build-macos: | |
# Because of include path conflicts when both Qt5 and Qt6 are installed, | |
# we run these as separate builds | |
name: "macos-latest with ${{matrix.config.qt}}" | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- qt: Qt5 | |
gtk: ON | |
sdl: ON | |
- qt: Qt6 | |
gtk: OFF | |
sdl: OFF | |
runs-on: macos-latest | |
steps: | |
- name: 'Install dependencies' | |
run: | | |
brew install pkg-config \ | |
ninja \ | |
eigen \ | |
ffmpeg \ | |
cspice \ | |
fmt \ | |
jpeg \ | |
gettext \ | |
gperf \ | |
libpng \ | |
lua \ | |
freetype \ | |
libepoxy \ | |
libavif | |
if [ "${{matrix.config.qt}}" = "Qt5" ]; then | |
brew install qt@5 | |
else | |
brew install qt@6 | |
fi | |
if [ "${{matrix.config.gtk}}" = "ON" ]; then | |
brew install gtk+ gtkglext | |
fi | |
if [ "${{matrix.config.sdl}}" = "ON" ]; then | |
brew install sdl2 | |
fi | |
- name: 'Checkout source code' | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: 'Configure CMake' | |
run: | | |
if [ "${{matrix.config.qt}}" = "Qt5" ]; then | |
UseQt5=ON | |
else | |
UseQt6=ON | |
fi | |
cmake -B ${{github.workspace}}/build \ | |
-G Ninja \ | |
-DENABLE_GLES=OFF \ | |
-DENABLE_SPICE=ON \ | |
-DENABLE_TOOLS=OFF \ | |
-DENABLE_TESTS=ON \ | |
-DENABLE_SDL=${{matrix.config.sdl}} \ | |
-DENABLE_GTK=${{matrix.config.gtk}} \ | |
-DUSE_GTK3=OFF \ | |
-DENABLE_QT5=${UseQt5:OFF} \ | |
-DENABLE_QT6=${UseQt6:OFF} \ | |
-DUSE_WAYLAND=OFF \ | |
-DENABLE_FFMPEG=ON \ | |
-DENABLE_LIBAVIF=ON \ | |
-DENABLE_MINIAUDIO=ON \ | |
-DUSE_ICU=OFF | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
run: ninja | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest | |
gnulinux-arm64: | |
runs-on: self-hosted | |
steps: | |
- name: 'Install dependencies' | |
run: | | |
#sudo dnf config-manager --set-enabled ol8_codeready_builder | |
sudo yum install -y eigen3-devel \ | |
libepoxy-devel \ | |
libpng-devel \ | |
libjpeg-turbo-devel \ | |
freetype-devel \ | |
SDL2-devel \ | |
lua-devel \ | |
gtk3-devel \ | |
qt5-qtbase-devel \ | |
qt5-qttools \ | |
gettext-devel \ | |
libicu-devel \ | |
cmake \ | |
gperf \ | |
ninja-build \ | |
gcc-toolset-11-gcc-c++ | |
- name: 'Checkout source code' | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: 'Configure CMake' | |
run: | | |
cmake -B ${{github.workspace}}/build \ | |
-G Ninja \ | |
-DENABLE_GLES=ON \ | |
-DENABLE_SPICE=ON \ | |
-DENABLE_TOOLS=ON \ | |
-DENABLE_TESTS=ON \ | |
-DENABLE_SDL=ON \ | |
-DENABLE_GTK=ON \ | |
-DUSE_GTK3=ON \ | |
-DENABLE_QT5=ON \ | |
-DENABLE_QT6=OFF \ | |
-DENABLE_FFMPEG=OFF \ | |
-DENABLE_MINIAUDIO=ON \ | |
-DUSE_ICU=ON | |
env: | |
CC: /opt/rh/gcc-toolset-11/root/usr/bin/gcc | |
CXX: /opt/rh/gcc-toolset-11/root/usr/bin/g++ | |
- name: Build | |
working-directory: ${{github.workspace}}/build | |
run: ninja | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
run: ctest |