metaforce/.github/workflows/release.yml

338 lines
12 KiB
YAML
Raw Normal View History

2021-04-06 19:20:29 +00:00
name: Release
on:
push:
branches:
2021-04-24 21:19:35 +00:00
- main
2021-04-06 19:20:29 +00:00
paths-ignore:
- '*.json'
- '*.md'
- '*LICENSE'
env:
BUILDCACHE_VERSION: v0.27.3
BUILDCACHE_ACCURACY: STRICT
BUILDCACHE_MAX_CACHE_SIZE: 1073741824 # 1GiB
SENTRY_DSN: ${{secrets.SENTRY_DSN}}
2021-04-06 19:20:29 +00:00
jobs:
build-linux:
name: Build Linux (${{matrix.name}} x86_64)
runs-on: ubuntu-20.04
env:
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
2021-04-06 19:20:29 +00:00
strategy:
fail-fast: false
matrix:
include:
- name: GCC
preset: gcc
2021-04-06 19:20:29 +00:00
- name: Clang
preset: clang
2021-04-06 19:20:29 +00:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
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-06 19:20:29 +00:00
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 qt5-default libfreetype-dev
2021-04-06 19:20:29 +00:00
yarn global add @sentry/cli
echo "$(yarn global bin)" >> $GITHUB_PATH
# setup buildcache
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-linux.tar.gz | tar xz -C "$RUNNER_WORKSPACE"
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
2021-04-06 19:20:29 +00:00
# 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: Restore buildcache
2021-06-12 14:35:07 +00:00
uses: pat-s/always-upload-cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-${{matrix.preset}}-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-${{matrix.preset}}-
2021-04-06 19:20:29 +00:00
- name: Configure CMake
run: cmake --preset x-linux-ci-${{matrix.preset}}
2021-04-06 19:20:29 +00:00
- name: Build
run: cmake --build --preset x-linux-ci-${{matrix.preset}}
- name: Print buildcache stats
run: buildcache -s
2021-04-06 19:20:29 +00:00
- name: Upload debug information
if: ${{matrix.name == 'Clang'}}
env:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
SENTRY_URL: ${{secrets.SENTRY_URL}}
run: ci/upload-debug-linux.sh
- name: Generate AppImage
run: ci/build-appimage.sh
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-06-12 04:13:57 +00:00
name: metaforce-${{env.METAFORCE_VERSION}}-linux-${{matrix.preset}}-x86_64
2021-04-06 19:20:29 +00:00
path: |
2021-06-12 04:13:57 +00:00
build/install/Metaforce-*.AppImage
build/install/debug.tar.*
2021-04-06 19:20:29 +00:00
build-macos:
name: Build macOS (AppleClang universal)
2021-04-06 19:20:29 +00:00
runs-on: macos-10.15
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.192
BUILDCACHE_DIR: ${{github.workspace}}/.buildcache
2021-04-06 19:20:29 +00:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install dependencies
run: |
brew update
2021-05-02 04:04:14 +00:00
brew upgrade --formula
brew install ninja graphicsmagick imagemagick getsentry/tools/sentry-cli freetype
2021-04-06 19:20:29 +00:00
yarn global add create-dmg
# universal qt5 from macports
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 /
echo /opt/local/libexec/qt5/bin >> $GITHUB_PATH
# setup buildcache
curl -LSfs https://github.com/encounter/buildcache/releases/download/$BUILDCACHE_VERSION/buildcache-macos.zip -o /tmp/buildcache-macos.zip
unzip /tmp/buildcache-macos.zip -d "$RUNNER_WORKSPACE"
echo "$RUNNER_WORKSPACE"/buildcache/bin >> $GITHUB_PATH
- name: Install Intel IPP
if: 'false' # not supported for universal build
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: Restore buildcache
2021-06-12 14:35:07 +00:00
uses: pat-s/always-upload-cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-universal-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-universal-
2021-04-06 19:20:29 +00:00
- name: Configure CMake
run: cmake --preset x-macos-ci
2021-04-06 19:20:29 +00:00
- name: Build
run: cmake --build --preset x-macos-ci
- name: Print buildcache stats
run: buildcache -s
2021-04-06 19:20:29 +00:00
- name: Upload debug information
env:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
SENTRY_URL: ${{secrets.SENTRY_URL}}
run: ci/upload-debug-macos.sh
- 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
2021-04-06 19:20:29 +00:00
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-06-12 04:13:57 +00:00
name: metaforce-${{env.METAFORCE_VERSION}}-macos-appleclang-universal
path: |
2021-06-12 04:13:57 +00:00
build/install/Metaforce *.dmg
build/install/debug.tar.*
2021-04-06 19:20:29 +00:00
build-windows-msvc:
name: Build Windows (MSVC x86_64)
runs-on: [ self-hosted, windows, x64 ]
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.210
2021-04-06 19:20:29 +00:00
SENTRY_CLI_VERSION: 1.63.2
BUILDCACHE_DIR: C:\buildcache
BUILD_DIR: ${{github.workspace}}/build
BUILDCACHE_MAX_CACHE_SIZE: 5368709120 # 5GiB
2021-04-06 19:20:29 +00:00
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-full.7z"
2021-04-06 19:20:29 +00:00
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: Download sentry-cli
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(New-Object Net.WebClient).DownloadFile("https://github.com/getsentry/sentry-cli/releases/download/$env:SENTRY_CLI_VERSION/sentry-cli-Windows-x86_64.exe", "$TempDir\sentry-cli.exe")
- name: Install dependencies
run: |
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(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
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
2021-04-06 19:20:29 +00:00
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
run: cmake --preset x-windows-ci-msvc
2021-04-06 19:20:29 +00:00
- name: Build
run: cmake --build --preset x-windows-ci-msvc
- name: Print buildcache stats
run: buildcache -s
2021-04-06 19:20:29 +00:00
- name: Upload debug information
working-directory: ${{env.BUILD_DIR}}/install
2021-04-06 19:20:29 +00:00
env:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
SENTRY_URL: ${{secrets.SENTRY_URL}}
run: |
2021-04-06 22:58:11 +00:00
& "$env:RUNNER_WORKSPACE\temp\sentry-cli.exe" upload-dif --org axiodl --project metaforce --include-sources `
2021-06-12 15:05:22 +00:00
(Get-Item '*.exe', '*.pdb').Name
2021-04-06 19:20:29 +00:00
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-06 22:58:11 +00:00
name: metaforce-${{env.METAFORCE_VERSION}}-win32-msvc-x86_64
2021-04-06 19:20:29 +00:00
path: |
${{env.BUILD_DIR}}/install/*.exe
${{env.BUILD_DIR}}/install/debug.7z
2021-04-06 19:20:29 +00:00
build-windows-clang:
name: Build Windows (Clang x86_64)
runs-on: windows-2019
2021-04-06 19:20:29 +00:00
env:
Qt_VERSION: 5.15.2
IPP_VERSION: 2021.2.0.210
# C: has ~90GB available space at the moment
BUILDCACHE_DIR: C:\buildcache
BUILD_DIR: C:\build
2021-04-06 19:20:29 +00:00
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Install vcpkg Qt
2021-04-06 19:20:29 +00:00
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "vcpkg-qt-$env:Qt_VERSION-full.7z"
2021-04-06 19:20:29 +00:00
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-06 19:20:29 +00:00
- name: Install Intel IPP
if: 'false' # takes >10min, not worth it
2021-04-06 19:20:29 +00:00
run: |
$TempDir = "$env:RUNNER_WORKSPACE\temp"
$Filename = "w_ipp_oneapi_p_${env:IPP_VERSION}_offline.exe"
2021-04-06 19:20:29 +00:00
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-04-06 19:20:29 +00:00
- name: Install dependencies
run: |
choco install ninja vulkan-sdk
# set up buildcache
$TempDir = "$env:RUNNER_WORKSPACE\temp"
New-Item -Path "$TempDir" -ItemType Directory -ea 0
(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
echo "$TempDir\buildcache\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# check available disk space
Get-PSDrive
- name: Restore buildcache
2021-06-12 14:35:07 +00:00
uses: pat-s/always-upload-cache@v2
with:
path: ${{env.BUILDCACHE_DIR}}
key: buildcache-${{runner.os}}-clang-${{github.sha}}
restore-keys: |
buildcache-${{runner.os}}-clang-
2021-04-06 19:20:29 +00:00
- name: Enable Visual Studio environment
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
run: cmake --preset x-windows-ci-clang
2021-04-06 19:20:29 +00:00
- name: Build
run: cmake --build --preset x-windows-ci-clang
- name: Print buildcache stats
run: buildcache -s
2021-04-06 19:20:29 +00:00
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-04-06 22:58:11 +00:00
name: metaforce-${{env.METAFORCE_VERSION}}-win32-clang-x86_64
2021-04-06 19:20:29 +00:00
path: |
${{env.BUILD_DIR}}/install/*.exe
${{env.BUILD_DIR}}/install/debug.7z