metaforce/.github/workflows/build.yml

197 lines
6.4 KiB
YAML

name: Build
on:
push:
branches-ignore:
- master
paths-ignore:
- '*.json'
- '*.md'
- '*LICENSE'
pull_request:
jobs:
build-linux:
name: Build Linux (${{matrix.name}} x86_64)
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- name: GCC
cc: gcc
cxx: g++
- name: Clang
cc: clang
cxx: clang++
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install curl git cmake ninja-build clang lld qt5-default libcurl4-openssl-dev \
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3
# free up disk space
# https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173
echo Before
df -h .
sudo apt-get clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo After
df -h .
- name: Configure CMake
run: |
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
-DCMAKE_C_COMPILER=${{matrix.cc}} -DCMAKE_CXX_COMPILER=${{matrix.cxx}}
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.cc}}-x86_64
path: install
build-macos:
name: Build macOS (AppleClang universal)
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew install ninja graphicsmagick imagemagick
yarn global add create-dmg
# universal qt5 from macports
curl -LSfs https://axiodl.com/files/qt5-5.15.2.mkpkg -o /tmp/qt5-5.15.2.mkpkg
sudo installer -pkg /tmp/qt5-5.15.2.mkpkg -target /
- name: Configure CMake
run: |
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install" \
-DQt5Widgets_DIR=/opt/local/libexec/qt5/lib/cmake/Qt5Widgets \
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
-DPNG_DIR=/opt/local/lib
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-x86_64
path: install
build-windows-msvc:
name: Build Windows (MSVC x86_64)
if: 'false' # disabled due to memory constraints
runs-on: windows-2019
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.210
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install vcpkg Qt
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "vcpkg-qt-$env:Qt_VERSION.7z"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
7z x "-o$env:RUNNER_WORKSPACE" -aos "$TempDir\$Filename"
- name: Install dependencies
run: choco install ninja vulkan-sdk
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Create build directory
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
run: |
$workspace = $env:RUNNER_WORKSPACE -replace '\\', '/'
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE\install" `
-DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-win32-msvc-x86_64
path: install
build-windows-clang:
name: Build Windows (Clang x86_64)
runs-on: windows-2019
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.210
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install vcpkg Qt
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "vcpkg-qt-$env:Qt_VERSION.7z"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://axiodl.com/files/$Filename", "$TempDir\$Filename")
7z x "-o$env:RUNNER_WORKSPACE" -aos "$TempDir\$Filename"
- name: Install dependencies
run: choco install ninja vulkan-sdk
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: |
$workspace = $env:RUNNER_WORKSPACE -replace '\\', '/'
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DCMAKE_INSTALL_PREFIX:PATH="$env:GITHUB_WORKSPACE/install" `
-DCMAKE_TOOLCHAIN_FILE="$workspace/vcpkg-qt-$env:Qt_VERSION/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows-static `
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded `
-DCMAKE_C_COMPILER=clang-cl `
-DCMAKE_CXX_COMPILER=clang-cl `
-DCMAKE_LINKER=lld-link
- name: Build
run: cmake --build build --config RelWithDebInfo --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-win32-clang-x86_64
path: install