Skip to content

Merge pull request #1757 from namark/gha-upgrade-grub-issue #544

Merge pull request #1757 from namark/gha-upgrade-grub-issue

Merge pull request #1757 from namark/gha-upgrade-grub-issue #544

Workflow file for this run

name: Master CI Build
on:
push:
branches:
- master
env:
APP_NAME: interface
BUILD_TYPE: Release
BUILD_NUMBER: ${{ github.run_number }}
CI_BUILD: Github
GIT_COMMIT: ${{ github.sha }}
RELEASE_TYPE: PRODUCTION
STABLE_BUILD: 0
UPLOAD_BUCKET: athena-public
# OSX-specific variables
DEVELOPER_DIR: /Applications/Xcode_11.2.app/Contents/Developer
# We are using macOS SDK 10.12 to work around a lot of OpenGL issues in newer SDKs.
# There are crashes on startup, crashes on window resize, etc. on newer macOS SDKs.
MACOSX_DEPLOYMENT_TARGET: '10.12'
# WIN-specific variables
PreferredToolArchitecture: X64
jobs:
build:
strategy:
matrix:
os: [windows-2019, macOS-10.15, ubuntu-18.04, ubuntu-20.04]
# build_type: [full, client]
build_type: [full]
include:
- os: ubuntu-18.04
build_type: full
apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion1 libpulse0 libsnappy1v5 libwebpdemux2 libwebpmux3
- os: ubuntu-20.04
build_type: full
apt-dependencies: mesa-common-dev libegl1 libglvnd-dev libdouble-conversion3 libpulse0 libsnappy1v5 libwebpdemux2 libwebpmux3
fail-fast: false
runs-on: ${{matrix.os}}
steps:
- name: Report Build Number
shell: bash
run: |
echo "Build number: $BUILD_NUMBER"
- name: Clear working directory
if: startsWith(matrix.os, 'windows')
shell: bash
working-directory: ${{runner.workspace}}
run: rm -rf ./*
- uses: actions/checkout@v1
with:
submodules: false
fetch-depth: 1
- name: Checkout ACME submodule
run: git submodule update --init libraries/networking/src/acme
- name: Configure build environment 1
shell: bash
id: buildenv1
run: |
echo "UPLOAD_PREFIX=master" >> $GITHUB_ENV
echo ::set-output name=github_sha_short::`echo $GIT_COMMIT | cut -c1-7`
echo "JOB_NAME=build (${{matrix.os}}, ${{matrix.build_type}})" >> $GITHUB_ENV
echo "APP_TARGET_NAME=$APP_NAME" >> $GITHUB_ENV
RELEASE_NUMBER=$(head -1 .VERSION)
RELEASE_NAME=$(tail -1 .VERSION)
echo "RELEASE_NUMBER=$RELEASE_NUMBER" >> $GITHUB_ENV
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
# Ununtu 20.04 build variables
if [[ "${{ matrix.os }}" = "ubuntu-20.04" ]]; then
echo "INSTALLER_EXT=*" >> $GITHUB_ENV
echo "VIRCADIA_QT_PATH=/opt/qt515" >> $GITHUB_ENV
echo "CMAKE_BUILD_EXTRA=-- -j$(nproc)" >> $GITHUB_ENV
if [[ "${{ matrix.os }}" = *"aarch64" ]]; then
echo "VCPKG_FORCE_SYSTEM_BINARIES=true" >> $GITHUB_ENV
fi
echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE=" >> $GITHUB_ENV
else
# other Linux build variables
if [[ "${{ matrix.os }}" = "ubuntu-"* ]]; then
echo "PYTHON_EXEC=python3" >> $GITHUB_ENV
echo "INSTALLER_EXT=tgz" >> $GITHUB_ENV
echo "CMAKE_BUILD_EXTRA=-- -j3" >> $GITHUB_ENV
echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DBUILD_TOOLS:BOOLEAN=FALSE -DHIFI_PYTHON_EXEC:FILEPATH=$(which python3)" >> $GITHUB_ENV
fi
fi
# Mac build variables
if [ "${{ matrix.os }}" = "macOS-10.15" ]; then
echo "PYTHON_EXEC=python3" >> $GITHUB_ENV
echo "ZIP_COMMAND=zip" >> $GITHUB_ENV
echo "ZIP_ARGS=-r" >> $GITHUB_ENV
echo "INSTALLER_EXT=dmg" >> $GITHUB_ENV
echo "CMAKE_EXTRA=-DVIRCADIA_CPU_ARCHITECTURE= -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib -G Xcode" >> $GITHUB_ENV
echo "::set-output name=symbols_archive::${BUILD_NUMBER}-${{ matrix.build_type }}-mac-symbols.zip"
echo "APP_TARGET_NAME=Vircadia" >> $GITHUB_ENV
fi
# Windows build variables
if [ "${{ matrix.os }}" = "windows-2019" ]; then
echo "PYTHON_EXEC=python" >> $GITHUB_ENV
echo "ZIP_COMMAND=7z" >> $GITHUB_ENV
echo "ZIP_ARGS=a" >> $GITHUB_ENV
echo "INSTALLER_EXT=exe" >> $GITHUB_ENV
echo "CMAKE_EXTRA=-A x64" >> $GITHUB_ENV
echo "SYMBOL_REGEX=\(exe\|dll\|pdb\)" >> $GITHUB_ENV
echo "symbols_archive=${BUILD_NUMBER}-${{ matrix.build_type }}-win-symbols.zip" >> $GITHUB_ENV
# echo "HF_PFX_PASSPHRASE=${{secrets.pfx_key}}" >> $GITHUB_ENV
# echo "HF_PFX_FILE=${{runner.workspace}}\build\codesign.pfx" >> $GITHUB_ENV
fi
# Configuration is broken into two steps because you can't set an env var and also reference it in the same step
- name: Configure build environment 2
shell: bash
run: |
echo "${{ steps.buildenv1.outputs.symbols_archive }}"
echo "ARTIFACT_PATTERN=Vircadia-*.$INSTALLER_EXT" >> $GITHUB_ENV
# Build type variables
echo "GIT_COMMIT_SHORT=${{ steps.buildenv1.outputs.github_sha_short }}" >> $GITHUB_ENV
if [ "${{ matrix.build_type }}" = "full" ]; then
echo "CLIENT_ONLY=FALSE" >> $GITHUB_ENV
echo "INSTALLER=Vircadia-$BUILD_NUMBER-$GIT_COMMIT_SHORT.$INSTALLER_EXT" >> $GITHUB_ENV
else
echo "CLIENT_ONLY=TRUE" >> $GITHUB_ENV
echo "INSTALLER=Vircadia-Interface-$BUILD_NUMBER-$GIT_COMMIT_SHORT.$INSTALLER_EXT" >> $GITHUB_ENV
fi
- name: Install dependencies
shell: bash
if: startsWith(matrix.os, 'ubuntu') || contains(matrix.os, 'debian') || startsWith(matrix.os, 'macOS')
run: |
if [[ "${{ matrix.os }}" =~ "ubuntu" || "${{ matrix.os }}" =~ "debian" ]]; then
echo "Installing Python Modules:"
pip3 install distro || exit 1
# workaround https://github.com/orgs/community/discussions/47863
sudo apt-mark hold grub-efi-amd64-signed
echo "Updating apt repository index"
sudo apt update || exit 1
echo "Installing apt packages"
sudo apt install -y ${{ matrix.apt-dependencies }} || exit 1
if [[ "${{ matrix.os }}" = "ubuntu-20.04" ]]; then
sudo apt-add-repository ppa:beineri/opt-qt-5.15.2-focal
sudo apt update
sudo apt upgrade
sudo apt install cmake g++ zip libgl-dev libssl-dev
sudo apt install qt5153d qt5153d-dbg qt515base qt515base-dbg qt515charts-no-lgpl qt515connectivity qt515connectivity-dbg qt515datavis3d-no-lgpl qt515declarative qt515declarative-dbg qt515doc qt515gamepad qt515graphicaleffects qt515graphicaleffects-dbg qt515imageformats qt515imageformats-dbg qt515location qt515location-dbg qt515lottie-no-lgpl qt515multimedia qt515multimedia-dbg qt515networkauth-no-lgpl qt515opcua qt515opcua-dbg qt515quick3d-no-lgpl qt515quickcontrols qt515quickcontrols-dbg qt515quickcontrols2 qt515quickcontrols2-dbg qt515quicktimeline-no-lgpl qt515remoteobjects qt515remoteobjects-dbg qt515script qt515script-dbg qt515scxml qt515scxml-dbg qt515sensors qt515sensors-dbg qt515serialbus qt515serialbus-dbg qt515serialport qt515serialport-dbg qt515speech qt515speech-dbg qt515svg qt515svg-dbg qt515tools qt515tools-dbg qt515translations qt515wayland qt515wayland-dbg qt515webchannel qt515webchannel-dbg qt515webengine qt515webengine-dbg qt515webglplugin-no-lgpl qt515websockets qt515websockets-dbg qt515x11extras qt515x11extras-dbg qt515xmlpatterns qt515xmlpatterns-dbg
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
sudo df -h
# attempt to free up space
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
# downgrade libstdc++6 to what is normal for Ubuntu 20.04
sudo apt-get install --allow-downgrades --no-remove --reinstall -y libstdc++6=10.5.0-1ubuntu1~20.04
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
sudo df -h
fi
else # macOS
echo "Downloading MacOSX10.12 SDK.."
# TODO: do this in cmake or python build scripts to make use of centralized external asset configuration with fallback gateways.
curl --progress-bar -L -o macOS_SDK10.12.4.tar.xz "https://ipfs.vircadia.dev/ipfs/QmTDLEYdo616YgZKSYC2mySSw8EKQWTz7CH8UyMupMBpzK?filename=macOS_SDK10.12.4.tar.xz" || exit 1
echo " done\n"
echo "Checking MacOSX10.12 SDK.."
echo "c00e03cb64bed8d0d75d7a01c93de094b6ffaa3bc3318e7b29a9bdc354f0e29e363c454b7db89db8a3b78e9702668d1c661f1af279807de8db11accecb0ca498 macOS_SDK10.12.4.tar.xz" >> macOS_SDK10.12.4.tar.xz.checksum
shasum -a 512 -w -c macOS_SDK10.12.4.tar.xz.checksum
echo "Extracting MacOSX10.12 SDK.."
tar -xf macOS_SDK10.12.4.tar.xz || exit 1
echo " done\n"
echo "Installing MacOSX10.12 SDK.."
# cp always sets an error code while copying the SDK so we return 0 when that happens.
sudo cp -rp MacOSX10.12.sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ || exit 0
echo " done"
fi
- name: Override NSIS
shell: pwsh
if: startsWith(matrix.os, 'windows')
run: choco install nsis --version=3.06.1
- name: Install Python modules
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
shell: bash
run: $PYTHON_EXEC -m pip install boto3 PyGithub
- name: Create build environment
shell: bash
run: cmake -E make_directory "${{runner.workspace}}/build"
- name: Configure CMake
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DVCPKG_BUILD_TYPE=release -DCLIENT_ONLY:BOOLEAN=$CLIENT_ONLY -DBYPASS_SIGNING:BOOLEAN=TRUE $CMAKE_EXTRA
- name: Build Domain Server
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target domain-server $CMAKE_BUILD_EXTRA
- name: Build Assignment Client
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target assignment-client $CMAKE_BUILD_EXTRA
- name: Build Oven
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target oven $CMAKE_BUILD_EXTRA
- name: Build ICE Server
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target ice-server $CMAKE_BUILD_EXTRA
- name: Build Deb Package
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'ubuntu-18.04'
shell: bash
run: DEBVERSION=$RELEASE_NUMBER DEBEMAIL="namark@digisomni.com" DEBFULLNAME="Na Mark" DEBBUILDDIR=${{runner.workspace}}/build ./pkg-scripts/make-deb-server
- name: Build Application
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target $APP_TARGET_NAME $CMAKE_BUILD_EXTRA
- name: Build Console
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config $BUILD_TYPE --target packaged-server-console $CMAKE_BUILD_EXTRA
- name: Build Installer
if: matrix.os != 'ubuntu-20.04' && matrix.os != 'ubuntu-18.04'
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
echo "Retry code from https://unix.stackexchange.com/a/137639"
function fail {
echo $1 >&2
exit 1
}
function retry {
local n=1
local max=5
local delay=15
while true; do
"$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
echo "Command failed. Attempt $n/$max:"
sleep $delay;
else
fail "The command has failed after $n attempts."
fi
}
done
}
retry cmake --build . --config $BUILD_TYPE --target package $CMAKE_BUILD_EXTRA
#- name: Sign installer (Windows)
# if: startsWith(matrix.os, 'windows')
# shell: powershell
# working-directory: C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64
# run: .\signtool.exe sign /fd sha256 /f ${{runner.workspace}}\build\codesign.pfx /p ${{secrets.pfx_key}} /tr http://sha256timestamp.ws.symantec.com/sha256/timestamp /td SHA256 ${{runner.workspace}}\build\${env:INSTALLER}
- name: Output system stats
if: ${{ always() }}
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
echo "Disk usage:"
df -h
- name: Output installer logs
if: failure() && startsWith(matrix.os, 'windows')
shell: bash
working-directory: ${{runner.workspace}}/build
run: cat ./_CPack_Packages/win64/NSIS/NSISOutput.log
- name: Upload full build
if: matrix.build_type == 'full' && (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS'))
uses: actions/upload-artifact@v3
with:
name: build-full-${{ matrix.os }}-${{ github.event.number }}
path: ${{ runner.workspace }}/build/Vircadia-*.${{ env.INSTALLER_EXT }}
if-no-files-found: error
- name: Upload client build
if: matrix.build_type == 'client' && (startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS'))
uses: actions/upload-artifact@v3
with:
name: build-interface-${{ matrix.os }}-${{ github.event.number }}
path: ${{ runner.workspace }}/build/Vircadia-*.${{ env.INSTALLER_EXT }}
if-no-files-found: error
- name: Upload Deb Packages
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: build-server-${{ matrix.os }}-${{ github.event.number }}
path: ./*.deb
if-no-files-found: error
#- name: Archive symbols
# if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
# working-directory: ${{runner.workspace}}
# shell: bash
# run: |
# SYMBOLS_TEMP="symbols-temp"
# mkdir $SYMBOLS_TEMP
# find "./build" \( -path '*/tools/gpu-frame-player/*' -or -path '*/interface/*' -or -path '*/plugins/*' \) -regex ".*\.$SYMBOL_REGEX" -exec cp -r {} $SYMBOLS_TEMP \;
# cd $SYMBOLS_TEMP
# $ZIP_COMMAND $ZIP_ARGS ../${{ steps.buildenv1.outputs.symbols_archive }} .
#- name: Upload symbols
# if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
# working-directory: ${{runner.workspace}}
# shell: bash
# run: |
# curl --data-binary @${{ steps.buildenv1.outputs.symbols_archive }} "$CMAKE_BACKTRACE_URL/post?format=symbols&token=$CMAKE_BACKTRACE_SYMBOLS_TOKEN&upload_file=${{steps.buildenv1.outputs.symbols_archive}}&tag=$BUILD_NUMBER"
#- name: Debug list symbols
# if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
# working-directory: ${{runner.workspace}}
# shell: bash
# run: |
# unzip -v "${{runner.workspace}}/${{ steps.buildenv1.outputs.symbols_archive }}"
#- name: Upload debug list symbols
# if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
# uses: actions/upload-artifact@v1
# with:
# name: symbols
# path: ${{runner.workspace}}/${{ steps.buildenv1.outputs.symbols_archive }}