metaforce/.github/workflows/build.yml

239 lines
8.6 KiB
YAML
Raw Normal View History

2021-03-02 02:36:10 +00:00
name: Build
on:
push:
paths-ignore:
- '*.json'
- '*.md'
- '*LICENSE'
2021-04-06 19:20:29 +00:00
pull_request:
2021-03-02 02:36:10 +00:00
2021-04-18 15:19:09 +00:00
env:
BUILD_TYPE: RelWithDebInfo
2021-03-02 02:36:10 +00:00
jobs:
build-linux:
name: Build Linux (${{matrix.name}} x86_64)
2021-03-02 02:36:10 +00:00
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- name: GCC
cc: gcc
cxx: g++
- name: Clang
cc: clang
cxx: clang++
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
steps:
- uses: actions/checkout@v2
with:
2021-03-29 22:32:55 +00:00
fetch-depth: 0
2021-03-02 02:36:10 +00:00
submodules: recursive
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Install dependencies
run: |
2021-04-18 15:19:09 +00:00
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
sudo apt-get -y install curl git cmake ninja-build clang lld qt5-default libcurl4-openssl-dev \
2021-04-04 22:39:07 +00:00
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
2021-04-18 15:19:09 +00:00
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev python3 python-is-python3 \
intel-oneapi-ipp-devel ccache
yarn global add @sentry/cli
echo "$(yarn global bin)" >> $GITHUB_PATH
# 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 .
2021-03-07 20:42:48 +00:00
2021-04-18 15:19:09 +00:00
- name: Configure ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ubuntu-20.04-${{matrix.cc}}
max-size: 1G
2021-03-02 02:36:10 +00:00
- name: Configure CMake
2021-03-07 20:42:48 +00:00
run: |
2021-04-18 15:19:09 +00:00
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_INSTALL_PREFIX:PATH="$GITHUB_WORKSPACE/install" \
-DCMAKE_C_COMPILER:STRING=${{matrix.cc}} \
-DCMAKE_CXX_COMPILER:STRING=${{matrix.cxx}} \
-DCMAKE_C_COMPILER_LAUNCHER:STRING=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Build
2021-04-18 15:19:09 +00:00
run: cmake --build build --config $BUILD_TYPE --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.cc}}-x86_64
path: install
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
build-macos:
name: Build macOS (AppleClang universal)
2021-03-02 02:36:10 +00:00
runs-on: macos-10.15
2021-04-18 15:19:09 +00:00
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.192
2021-03-02 02:36:10 +00:00
steps:
- uses: actions/checkout@v2
with:
2021-03-29 22:32:55 +00:00
fetch-depth: 0
2021-03-02 02:36:10 +00:00
submodules: recursive
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Install dependencies
run: |
brew update
2021-04-18 15:19:09 +00:00
brew install ninja graphicsmagick imagemagick ccache
yarn global add create-dmg
# universal qt5 from macports
2021-04-18 15:30:33 +00:00
curl -LSfs https://axiodl.com/files/qt-$Qt_VERSION.mpkg -o /tmp/qt-$Qt_VERSION.mpkg
sudo installer -pkg /tmp/qt-$Qt_VERSION.mpkg -target /
2021-04-18 15:19:09 +00:00
- name: Install Intel IPP
run: |
NAME="m_ipp_oneapi_p_${IPP_VERSION}_offline"
curl -LSfs https://registrationcenter-download.intel.com/akdlm/irc_nas/17606/$NAME.dmg -o /tmp/$NAME.dmg
sudo hdiutil attach /tmp/$NAME.dmg -quiet
sudo /Volumes/$NAME/bootstrapper.app/Contents/MacOS/install.sh -c --action install --eula accept
sudo hdiutil detach /Volumes/$NAME -quiet
rm /tmp/$NAME.dmg
- name: Configure ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: macos-10.15-appleclang
max-size: 1G
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Configure CMake
run: |
2021-04-18 15:19:09 +00:00
cmake -B build . -GNinja -DCMAKE_BUILD_TYPE:STRING=$BUILD_TYPE \
-DCMAKE_C_COMPILER_LAUNCHER:STRING=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
-DCMAKE_INSTALL_PREFIX:PATH="$GITHUB_WORKSPACE/install" \
-DQt5Widgets_DIR:PATH=/opt/local/libexec/qt5/lib/cmake/Qt5Widgets \
-DCMAKE_OSX_ARCHITECTURES:STRING="arm64;x86_64" \
-DPNG_DIR:PATH=/opt/local/lib
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Build
2021-04-18 15:19:09 +00:00
run: cmake --build build --config $BUILD_TYPE --target install
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-18 15:19:09 +00:00
name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-universal
path: install
2021-03-07 20:42:48 +00:00
2021-04-18 15:19:09 +00:00
build-windows:
name: Build Windows (${{matrix.name}} x86_64)
2021-04-06 19:20:29 +00:00
runs-on: windows-2019
env:
Qt_VERSION: 5.15.2
2021-04-06 19:20:29 +00:00
IPP_VERSION: 2021.2.0.210
2021-04-18 15:19:09 +00:00
BUILDCACHE_VERSION: v0.26.1
# C: has ~90GB available space at the moment
BUILDCACHE_DIR: C:\buildcache
BUILD_DIR: C:\build
INSTALL_DIR: C:\install
strategy:
fail-fast: false
matrix:
include:
# disabled due to memory constraints
# - name: MSVC
# oname: msvc
# cc: cl
# ld: link
- name: Clang
oname: clang
cc: clang-cl
ld: lld-link
2021-03-02 02:36:10 +00:00
steps:
- uses: actions/checkout@v2
with:
2021-03-29 22:32:55 +00:00
fetch-depth: 0
2021-03-02 02:36:10 +00:00
submodules: recursive
2021-03-07 20:42:48 +00:00
- 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"
2021-04-18 15:19:09 +00:00
- name: Install Intel IPP
2021-03-07 20:42:48 +00:00
run: |
2021-04-18 15:19:09 +00:00
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "w_ipp_oneapi_p_${env:IPP_VERSION}_offline.exe"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://registrationcenter-download.intel.com/akdlm/irc_nas/17739/$Filename", "$TempDir\$Filename")
Start-Process "$TempDir\$Filename" -ArgumentList "--x --s --f $TempDir\ipp" -Wait
Start-Process "$TempDir\ipp\bootstrapper.exe" -ArgumentList "--eula accept -c --action install" -Wait
2021-03-07 20:42:48 +00:00
2021-04-18 15:19:09 +00:00
- name: Install dependencies
run: |
2021-04-18 15:19:09 +00:00
choco install ninja vulkan-sdk
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
2021-04-18 15:19:09 +00:00
(New-Object Net.WebClient).DownloadFile("https://github.com/mbitsnbites/buildcache/releases/download/$env:BUILDCACHE_VERSION/buildcache-windows.zip", "$TempDir\buildcache.zip")
Expand-Archive -LiteralPath "$TempDir\buildcache.zip" -DestinationPath "$TempDir"
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "BUILDCACHE_ACCURACY=STRICT" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "BUILDCACHE_MAX_CACHE_SIZE=1073741824" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
2021-04-18 15:19:09 +00:00
# check available disk space
Get-PSDrive
- name: Restore buildcache
uses: actions/cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-windows-2019-${{matrix.oname}}
2021-03-07 20:42:48 +00:00
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Configure CMake
2021-03-07 20:42:48 +00:00
run: |
2021-04-18 15:19:09 +00:00
buildcache -z
cmake -B "$env:BUILD_DIR" . -GNinja -DCMAKE_BUILD_TYPE:STRING=$env:BUILD_TYPE `
-DCMAKE_INSTALL_PREFIX:PATH="$env:INSTALL_DIR" `
-DCMAKE_TOOLCHAIN_FILE:PATH="$env:RUNNER_WORKSPACE\vcpkg-qt-$env:Qt_VERSION\scripts\buildsystems\vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static `
-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded `
-DCMAKE_C_COMPILER:STRING=${{matrix.cc}} `
-DCMAKE_CXX_COMPILER:STRING=${{matrix.cc}} `
-DCMAKE_LINKER:STRING=${{matrix.ld}} `
-DCMAKE_C_COMPILER_LAUNCHER:STRING=buildcache `
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=buildcache `
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="/MD /Z7 /O2 /Ob1 /DNDEBUG" `
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="/MD /Z7 /O2 /Ob1 /DNDEBUG"
- name: Build
2021-04-18 15:19:09 +00:00
run: cmake --build "$env:BUILD_DIR" --config $env:BUILD_TYPE --target install
- name: Print buildcache stats
run: buildcache -s
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-18 15:19:09 +00:00
name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.oname}}-x86_64
path: ${{env.INSTALL_DIR}}