metaforce/.github/workflows/build.yml

328 lines
10 KiB
YAML
Raw Normal View History

2021-03-02 02:36:10 +00:00
name: Build
on:
push:
2021-06-12 04:13:57 +00:00
branches-ignore:
- main
paths-ignore:
- '*.json'
- '*.md'
- '*LICENSE'
2021-04-06 19:20:29 +00:00
pull_request:
2021-03-02 02:36:10 +00:00
2021-06-12 01:19:33 +00:00
env:
2021-10-26 02:36:26 +00:00
BUILDCACHE_VERSION: v0.27.3
2021-06-12 01:19:33 +00:00
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
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
2021-06-12 01:19:33 +00:00
env:
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
strategy:
fail-fast: false
matrix:
include:
- name: GCC
2021-06-10 04:30:31 +00:00
preset: gcc
- name: Clang
2021-06-10 04:30:31 +00:00
preset: 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 ninja-build clang lld libcurl4-openssl-dev intel-oneapi-ipp-devel \
2021-04-04 22:39:07 +00:00
zlib1g-dev libglu1-mesa-dev libdbus-1-dev libvulkan-dev libxi-dev libxrandr-dev libasound2-dev \
2022-05-27 19:52:16 +00:00
libpulse-dev libudev-dev libpng-dev libncurses5-dev libx11-xcb-dev libfreetype-dev \
libxinerama-dev libxcursor-dev python3-markupsafe libgtk-3-dev
2021-04-18 15:19:09 +00:00
2021-06-12 01:19:33 +00:00
# setup buildcache
2021-10-26 02:36:26 +00:00
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
2021-06-12 01:19:33 +00:00
echo "$RUNNER_WORKSPACE"/buildcache/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-06-12 01:19:33 +00:00
- name: Restore buildcache
2021-06-12 14:35:07 +00:00
uses: pat-s/always-upload-cache@v2
2021-04-18 15:19:09 +00:00
with:
2021-06-12 01:19:33 +00:00
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-${{matrix.preset}}-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-${{matrix.preset}}-
2021-03-02 02:36:10 +00:00
- name: Configure CMake
2021-06-12 01:19:33 +00:00
run: cmake --preset x-linux-ci-${{matrix.preset}}
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Build
2021-06-12 01:19:33 +00:00
run: cmake --build --preset x-linux-ci-${{matrix.preset}}
- name: Print buildcache stats
run: buildcache -s
2021-03-07 20:42:48 +00:00
2022-06-13 05:46:28 +00:00
- name: Generate AppImage
run: ci/build-appimage.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.preset}}-x86_64
path: |
build/install/Metaforce-*.AppImage
build/install/debug.tar.*
2021-03-02 02:36:10 +00:00
build-macos:
name: Build macOS (AppleClang universal)
2021-10-26 15:38:01 +00:00
runs-on: macos-11
2021-06-12 01:19:33 +00:00
2021-04-18 15:19:09 +00:00
env:
IPP_VERSION: 2021.2.0.192
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
2021-06-12 01:19:33 +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: |
brew update
2021-05-02 04:04:14 +00:00
brew upgrade --formula
2022-06-13 05:46:28 +00:00
brew install ninja graphicsmagick imagemagick
yarn global add create-dmg
2022-05-27 19:52:16 +00:00
pip3 install markupsafe
2021-03-07 20:42:48 +00:00
2021-06-12 01:19:33 +00:00
# setup buildcache
2021-10-26 02:36:26 +00:00
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
2021-06-12 01:19:33 +00:00
unzip /tmp/buildcache-macos.zip -d "$RUNNER_WORKSPACE"
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
2021-04-18 15:19:09 +00:00
- name: Install Intel IPP
if: 'false' # not supported for universal build
2021-04-18 15:19:09 +00:00
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
2021-06-12 01:19:33 +00:00
- name: Restore buildcache
2021-06-12 14:35:07 +00:00
uses: pat-s/always-upload-cache@v2
2021-04-18 15:19:09 +00:00
with:
2021-06-12 01:19:33 +00:00
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-universal-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-universal-
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Configure CMake
2021-06-12 01:19:33 +00:00
run: cmake --preset x-macos-ci
2021-03-07 20:42:48 +00:00
2021-03-02 02:36:10 +00:00
- name: Build
2021-06-12 01:19:33 +00:00
run: cmake --build --preset x-macos-ci
- name: Print buildcache stats
if: 'false' # temporarily disabled
2021-06-12 01:19:33 +00:00
run: buildcache -s
2022-06-13 05:46:28 +00:00
- name: Import signing certificate
uses: devbotsxyz/xcode-import-certificate@master
with:
certificate-data: ${{secrets.MACOS_CERTIFICATE_DATA}}
certificate-passphrase: ${{secrets.MACOS_CERTIFICATE_PASSWORD}}
keychain-password: ${{secrets.MACOS_KEYCHAIN_PASSWORD}}
- name: Deploy & codesign application
env:
ASC_USERNAME: ${{secrets.MACOS_ASC_USERNAME}}
ASC_PASSWORD: ${{secrets.MACOS_ASC_PASSWORD}}
ASC_TEAM_ID: ${{secrets.MACOS_ASC_TEAM_ID}}
CODESIGN_IDENT: ${{secrets.MACOS_CODESIGN_IDENT}}
run: ci/build-dmg.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-universal
path: |
build/install/Metaforce *.dmg
build/install/debug.tar.*
2022-05-27 19:52:16 +00:00
build-ios:
2022-06-13 21:05:28 +00:00
name: Build iOS (AppleClang arm64)
2022-05-27 19:52:16 +00:00
runs-on: macos-11
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew upgrade --formula
brew install ninja
pip3 install markupsafe
- name: Configure CMake
run: cmake --preset ios-default
- name: Build
2022-06-13 21:05:28 +00:00
run: cmake --build --preset ios-default --target install
- name: Generate IPA
run: ci/build-ipa.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-ios-appleclang-arm64
path: |
build/install/Metaforce.ipa
build/install/debug.tar.*
2022-05-27 19:52:16 +00:00
build-tvos:
2022-06-13 21:05:28 +00:00
name: Build tvOS (AppleClang arm64)
2022-05-27 19:52:16 +00:00
runs-on: macos-11
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
brew upgrade --formula
brew install ninja
pip3 install markupsafe
- name: Configure CMake
run: cmake --preset tvos-default
- name: Build
2022-06-13 21:05:28 +00:00
run: cmake --build --preset tvos-default --target install
- name: Generate IPA
run: ci/build-ipa.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: metaforce-${{env.METAFORCE_VERSION}}-tvos-appleclang-arm64
path: |
build/install/Metaforce.ipa
build/install/debug.tar.*
2022-05-27 19:52:16 +00:00
2021-06-10 04:30:31 +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
# C: has ~90GB available space at the moment
BUILDCACHE_DIR: C:\buildcache
BUILD_DIR: C:\build
2021-06-10 04:30:31 +00:00
strategy:
fail-fast: false
matrix:
include:
- name: MSVC
preset: msvc
2021-06-10 04:30:31 +00:00
- name: Clang
preset: 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
- name: Install vcpkg Qt
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
2021-06-12 01:19:33 +00:00
$Filename = "vcpkg-qt-$env:Qt_VERSION-full.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-03-10 20:36:19 +00:00
2021-04-18 15:19:09 +00:00
- name: Install Intel IPP
if: 'false' # takes >10min, not worth it
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
2021-04-18 15:19:09 +00:00
$Filename = "w_ipp_oneapi_p_${env:IPP_VERSION}_offline.exe"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
2021-04-18 15:19:09 +00:00
(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
- name: Install dependencies
run: |
2021-04-18 15:19:09 +00:00
choco install ninja vulkan-sdk
2022-05-27 19:52:16 +00:00
pip install markupsafe
2021-04-18 15:19:09 +00:00
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
2021-10-26 02:36:26 +00:00
(New-Object Net.WebClient).DownloadFile("https://github.com/encounter/buildcache/releases/download/$env:BUILDCACHE_VERSION/buildcache-windows.zip", "$TempDir\buildcache.zip")
2021-06-12 14:04:28 +00:00
Expand-Archive -LiteralPath "$TempDir\buildcache.zip" -DestinationPath "$TempDir" -Force
2021-04-18 15:19:09 +00:00
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
2021-04-18 15:19:09 +00:00
# check available disk space
Get-PSDrive
- name: Restore buildcache
2021-06-12 14:35:07 +00:00
uses: pat-s/always-upload-cache@v2
2021-04-18 15:19:09 +00:00
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-${{matrix.preset}}-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-${{matrix.preset}}-
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-06-12 01:19:33 +00:00
run: cmake --preset x-windows-ci-${{matrix.preset}}
- name: Build
2021-06-12 01:19:33 +00:00
run: cmake --build --preset x-windows-ci-${{matrix.preset}}
2021-04-18 15:19:09 +00:00
- name: Print buildcache stats
run: buildcache -s
2022-06-13 05:46:28 +00:00
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2022-06-13 21:05:28 +00:00
name: metaforce-${{env.METAFORCE_VERSION}}-win32-${{matrix.preset}}-x86_64
2022-06-13 05:46:28 +00:00
path: |
${{env.BUILD_DIR}}/install/*.exe
${{env.BUILD_DIR}}/install/debug.7z