2020-07-07 12:19:21 +00:00
|
|
|
name: Build
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
2020-07-13 19:12:55 +00:00
|
|
|
build-linux:
|
2020-07-07 15:52:22 +00:00
|
|
|
runs-on: ${{ matrix.host_os }}
|
2020-07-13 19:12:55 +00:00
|
|
|
container: ${{ matrix.container }}
|
2020-07-07 12:19:21 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2020-07-07 15:52:22 +00:00
|
|
|
target_os: [linux]
|
2023-04-08 18:43:26 +00:00
|
|
|
host_os: [ubuntu-20.04]
|
2020-07-13 19:12:55 +00:00
|
|
|
container: ['']
|
2020-07-07 12:19:21 +00:00
|
|
|
fail-fast: false
|
|
|
|
steps:
|
2022-04-23 09:34:15 +00:00
|
|
|
- name: Switch to gcc-9
|
|
|
|
run: sudo apt install gcc-9 g++-9 && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9 && sudo update-alternatives --set gcc /usr/bin/gcc-9
|
|
|
|
if: matrix.host_os == 'ubuntu-18.04'
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Install Colobot dependencies
|
2023-08-15 10:47:27 +00:00
|
|
|
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet libglm-dev libmpg123-dev
|
2020-07-13 19:12:55 +00:00
|
|
|
if: matrix.container == ''
|
2020-07-09 16:56:08 +00:00
|
|
|
- uses: actions/checkout@v2
|
2020-07-11 10:41:33 +00:00
|
|
|
- name: Checkout the Google Test submodule
|
|
|
|
run: git submodule update --init -- lib/googletest
|
2022-02-26 20:47:22 +00:00
|
|
|
- name: Checkout the nlohmann json submodule
|
|
|
|
run: git submodule update --init -- lib/json
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Create build directory
|
|
|
|
run: cmake -E make_directory build
|
|
|
|
- name: Run CMake (for Linux)
|
2023-08-13 18:22:52 +00:00
|
|
|
run: cmake --preset Linux-CI
|
2020-07-13 19:12:55 +00:00
|
|
|
if: matrix.target_os == 'linux'
|
|
|
|
- name: Build
|
2023-08-13 18:22:52 +00:00
|
|
|
run: cmake --build --preset Linux-CI
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Install
|
2023-08-13 18:22:52 +00:00
|
|
|
run: cmake --build --preset Linux-CI --target install
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Patch library path
|
|
|
|
run: patchelf --set-rpath '.' install/colobot
|
|
|
|
if: matrix.target_os == 'linux'
|
|
|
|
- name: Upload build
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{matrix.target_os}}-debug
|
2023-08-13 18:22:52 +00:00
|
|
|
path: install
|
2023-04-08 18:43:26 +00:00
|
|
|
if: matrix.host_os == 'ubuntu-20.04'
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Create AppImage
|
|
|
|
working-directory: build
|
|
|
|
run: |
|
|
|
|
# Download app image tool
|
|
|
|
wget -N https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
|
|
|
chmod +x linuxdeploy-x86_64.AppImage
|
|
|
|
./linuxdeploy-x86_64.AppImage --appimage-extract
|
|
|
|
|
|
|
|
# Create AppImage
|
|
|
|
NO_STRIP=1 ./squashfs-root/AppRun -e colobot --output appimage --appdir colobot.AppDir -d desktop/colobot.desktop -i ../desktop/colobot.svg
|
2023-07-22 19:23:13 +00:00
|
|
|
chmod +x Colobot-x86_64.AppImage
|
2020-07-13 19:12:55 +00:00
|
|
|
|
|
|
|
# Prepare folder for zip
|
|
|
|
mkdir -p appimage
|
2023-08-13 18:22:52 +00:00
|
|
|
cp -rp ../install/data appimage/data
|
|
|
|
cp -rp ../install/lang appimage/lang
|
2023-07-22 19:31:49 +00:00
|
|
|
cp -p Colobot-x86_64.AppImage appimage/colobot
|
2020-07-11 17:12:45 +00:00
|
|
|
if: matrix.target_os == 'linux'
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Upload AppImage
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{matrix.target_os}}-debug-AppImage
|
|
|
|
path: build/appimage
|
2023-04-08 18:43:26 +00:00
|
|
|
if: matrix.target_os == 'linux' && matrix.host_os == 'ubuntu-20.04'
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Run tests
|
|
|
|
# TODO: Maybe run Windows tests using wine as well?
|
|
|
|
working-directory: build
|
|
|
|
run: ./colobot_ut --gtest_output=xml:gtestresults.xml
|
|
|
|
if: matrix.target_os == 'linux'
|
|
|
|
- name: Upload test results
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
|
|
|
|
path: build/gtestresults.xml
|
|
|
|
if: matrix.target_os == 'linux'
|
2022-09-13 17:58:11 +00:00
|
|
|
build-macos:
|
|
|
|
runs-on: ${{ matrix.host_os }}
|
|
|
|
container: ${{ matrix.container }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target_os: [macos]
|
|
|
|
host_os: [macos-11, macos-12]
|
|
|
|
container: ['']
|
|
|
|
fail-fast: false
|
|
|
|
steps:
|
|
|
|
- name: Install Colobot dependencies
|
2023-08-15 10:47:27 +00:00
|
|
|
run: brew install cmake sdl2 sdl2_image sdl2_ttf glew physfs flac libsndfile libvorbis vorbis-tools gettext libicns librsvg wget xmlstarlet glm
|
2022-09-13 17:58:11 +00:00
|
|
|
if: matrix.container == ''
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Checkout the Google Test submodule
|
|
|
|
run: git submodule update --init -- lib/googletest
|
2023-04-14 22:29:07 +00:00
|
|
|
- name: Checkout the nlohmann json submodule
|
|
|
|
run: git submodule update --init -- lib/json
|
2022-09-13 17:58:11 +00:00
|
|
|
- name: Create build directory
|
|
|
|
run: cmake -E make_directory build
|
|
|
|
- name: Run CMake (for Mac)
|
2023-08-13 20:36:13 +00:00
|
|
|
run: cmake --preset MacOS-CI
|
2022-09-13 17:58:11 +00:00
|
|
|
if: matrix.target_os == 'macos'
|
|
|
|
- name: Build
|
2023-08-13 20:36:13 +00:00
|
|
|
run: cmake --build --preset MacOS-CI
|
2022-09-14 21:25:16 +00:00
|
|
|
- name: Run tests
|
|
|
|
# TODO: Maybe run Windows tests using wine as well?
|
2022-09-13 19:48:43 +00:00
|
|
|
working-directory: build
|
2022-09-14 21:25:16 +00:00
|
|
|
run: ./colobot_ut --gtest_output=xml:gtestresults.xml
|
|
|
|
if: matrix.target_os == 'macos'
|
|
|
|
- name: Upload test results
|
2022-09-13 17:58:11 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2022-09-14 21:25:16 +00:00
|
|
|
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
|
|
|
|
path: build/gtestresults.xml
|
|
|
|
if: matrix.target_os == 'macos'
|
2020-07-13 19:12:55 +00:00
|
|
|
build-windows:
|
|
|
|
runs-on: windows-2019
|
2020-07-14 19:07:01 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
- arch: amd64
|
|
|
|
vcpkg_triplet: 'x64-windows-static'
|
|
|
|
- arch: x86
|
|
|
|
vcpkg_triplet: 'x86-windows-static'
|
2020-07-13 19:12:55 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Checkout the Google Test submodule
|
|
|
|
run: git submodule update --init -- lib/googletest
|
2022-02-26 20:47:22 +00:00
|
|
|
- name: Checkout the nlohmann json submodule
|
|
|
|
run: git submodule update --init -- lib/json
|
2020-07-11 17:12:45 +00:00
|
|
|
- name: Install Ninja
|
|
|
|
uses: seanmiddleditch/gha-setup-ninja@master
|
|
|
|
- name: Setup VS Environment
|
|
|
|
uses: seanmiddleditch/gha-setup-vsdevenv@master
|
2020-07-14 19:07:01 +00:00
|
|
|
with:
|
|
|
|
arch: ${{ matrix.arch }}
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Install Colobot dependencies
|
2021-09-04 19:11:54 +00:00
|
|
|
uses: lukka/run-vcpkg@v7
|
2020-07-11 17:12:45 +00:00
|
|
|
with:
|
2023-04-10 18:55:39 +00:00
|
|
|
setupOnly: true
|
2023-06-28 21:52:01 +00:00
|
|
|
vcpkgGitCommitId: 'f6a5d4e8eb7476b8d7fc12a56dff300c1c986131'
|
2020-07-14 19:07:01 +00:00
|
|
|
vcpkgTriplet: ${{ matrix.vcpkg_triplet }}
|
2023-04-10 18:55:39 +00:00
|
|
|
# SHA-256 hash of the vcpkg.json file, recalculated automatically when it changes
|
|
|
|
appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }}
|
2023-04-10 20:36:52 +00:00
|
|
|
additionalCachedPaths: ${{ github.workspace }}/build/vcpkg_installed
|
2020-07-13 19:12:55 +00:00
|
|
|
- name: Install external tools
|
2020-07-11 17:12:45 +00:00
|
|
|
working-directory: ${{ github.workspace }}
|
|
|
|
run: |
|
|
|
|
echo "Downloading gettext..."
|
|
|
|
(New-Object System.Net.WebClient).DownloadFile("https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.20.2-v1.16/gettext0.20.2-iconv1.16-static-64.zip", "gettext.zip");
|
|
|
|
echo "Unpacking gettext..."
|
|
|
|
7z x -ogettext gettext.zip;
|
|
|
|
echo "Adding gettext to PATH..."
|
2021-09-04 19:59:49 +00:00
|
|
|
echo "${{ github.workspace }}\gettext\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2020-07-11 17:12:45 +00:00
|
|
|
echo "Downloading xmlstarlet..."
|
|
|
|
(New-Object System.Net.WebClient).DownloadFile("https://downloads.sourceforge.net/project/xmlstar/xmlstarlet/1.6.1/xmlstarlet-1.6.1-win32.zip", "xmlstarlet.zip");
|
|
|
|
echo "Unpacking xmlstarlet..."
|
|
|
|
7z x -oxmlstarlet xmlstarlet.zip;
|
|
|
|
echo "Renaming xml.exe to xmlstarlet.exe"
|
|
|
|
Rename-Item -Path "${{ github.workspace }}\xmlstarlet\xmlstarlet-1.6.1\xml.exe" -NewName "xmlstarlet.exe"
|
|
|
|
echo "Adding xmlstarlet to PATH..."
|
2021-09-04 19:59:49 +00:00
|
|
|
echo "${{ github.workspace }}\xmlstarlet\xmlstarlet-1.6.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2020-07-11 17:12:45 +00:00
|
|
|
echo "Downloading rsvg-convert..."
|
|
|
|
(New-Object System.Net.WebClient).DownloadFile("https://downloads.sourceforge.net/project/tumagcc/rsvg-convert-2.40.20.7z", "rsvg-convert.zip");
|
|
|
|
echo "Unpacking xmlstarlet..."
|
|
|
|
7z x -orsvg-convert rsvg-convert.zip;
|
|
|
|
echo "Adding rsvg-convert to PATH..."
|
2021-09-04 19:59:49 +00:00
|
|
|
echo "${{ github.workspace }}\rsvg-convert" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
2020-07-11 17:12:45 +00:00
|
|
|
shell: pwsh
|
2020-07-07 12:19:21 +00:00
|
|
|
- name: Create build directory
|
|
|
|
run: cmake -E make_directory build
|
2020-07-11 17:12:45 +00:00
|
|
|
- name: Run CMake (for Windows)
|
2023-08-13 17:51:57 +00:00
|
|
|
run: cmake --preset Windows-CI -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake
|
2020-07-07 12:19:21 +00:00
|
|
|
- name: Build
|
2020-07-13 19:12:55 +00:00
|
|
|
run: |
|
|
|
|
$nproc = (Get-CIMInstance -Class 'CIM_Processor').NumberOfLogicalProcessors
|
2023-08-13 17:51:57 +00:00
|
|
|
cmake --build --preset Windows-CI -j $nproc
|
2020-07-13 19:12:55 +00:00
|
|
|
shell: pwsh
|
2020-07-07 12:19:21 +00:00
|
|
|
- name: Install
|
2023-08-13 17:51:57 +00:00
|
|
|
run: cmake --build --preset Windows-CI --target install
|
2020-07-07 12:19:21 +00:00
|
|
|
- name: Upload build
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2020-07-14 19:07:01 +00:00
|
|
|
name: windows-msvc-debug-${{ matrix.arch }}
|
2023-08-13 17:51:57 +00:00
|
|
|
path: install
|
2020-07-07 12:19:21 +00:00
|
|
|
- name: Run tests
|
|
|
|
working-directory: build
|
|
|
|
run: ./colobot_ut --gtest_output=xml:gtestresults.xml
|
|
|
|
- name: Upload test results
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2020-07-14 19:07:01 +00:00
|
|
|
name: 'Test results (windows, MSVC, ${{ matrix.arch }})'
|
2020-07-07 12:19:21 +00:00
|
|
|
path: build/gtestresults.xml
|
|
|
|
doc:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-07-07 15:52:22 +00:00
|
|
|
- name: Install Colobot dependencies
|
2023-08-15 10:47:27 +00:00
|
|
|
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet doxygen graphviz libglm-dev libmpg123-dev
|
2020-07-09 16:56:08 +00:00
|
|
|
- uses: actions/checkout@v2
|
2020-07-07 12:19:21 +00:00
|
|
|
- name: Create build directory
|
|
|
|
run: cmake -E make_directory build
|
2022-02-26 21:32:00 +00:00
|
|
|
- name: Checkout the nlohmann json submodule
|
|
|
|
run: git submodule update --init -- lib/json
|
2020-07-07 12:19:21 +00:00
|
|
|
- name: Run CMake
|
|
|
|
working-directory: build
|
|
|
|
run: cmake ..
|
|
|
|
- name: Build docs
|
|
|
|
working-directory: build
|
|
|
|
run: make doc
|
|
|
|
- name: Upload docs
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: doc
|
|
|
|
path: build/doc
|