mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-05 21:02:25 +02:00
187 lines
6.3 KiB
YAML
187 lines
6.3 KiB
YAML
name: tagged Release Build
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
env:
|
|
APP_NAME: interface
|
|
BUILD_TYPE: Release
|
|
CI_BUILD: Github
|
|
GIT_COMMIT: ${{ github.sha }}
|
|
RELEASE_TYPE: PRODUCTION
|
|
RELEASE_NUMBER: ${{ github.ref_name }}
|
|
STABLE_BUILD: 1
|
|
UPLOAD_BUCKET: overte-public
|
|
UPLOAD_REGION: fra1
|
|
UPLOAD_ENDPOINT: "https://fra1.digitaloceanspaces.com"
|
|
|
|
# WIN-specific variables
|
|
PreferredToolArchitecture: X64
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: windows-2019
|
|
build_type: full
|
|
fail-fast: false
|
|
runs-on: ${{matrix.os}}
|
|
steps:
|
|
- name: Report Build Number
|
|
shell: bash
|
|
run: |
|
|
|
|
echo "Build number: $BUILD_NUMBER"
|
|
|
|
- name: Configure build environment 1
|
|
shell: bash
|
|
id: buildenv1
|
|
run: |
|
|
|
|
echo "UPLOAD_PREFIX=build/overte/release/$RELEASE_NUMBER" >> $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
|
|
# 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
|
|
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=Overte-*.$INSTALLER_EXT" >> $GITHUB_ENV
|
|
echo "GIT_COMMIT_SHORT=${{ steps.buildenv1.outputs.github_sha_short }}" >> $GITHUB_ENV
|
|
# Build type variables
|
|
if [ "${{ matrix.build_type }}" = "full" ]; then
|
|
echo "CLIENT_ONLY=FALSE" >> $GITHUB_ENV
|
|
echo "INSTALLER=Overte-x86_64-$RELEASE_NUMBER-${{ steps.buildenv1.outputs.github_sha_short }}.$INSTALLER_EXT" >> $GITHUB_ENV
|
|
else
|
|
echo "CLIENT_ONLY=TRUE" >> $GITHUB_ENV
|
|
echo "INSTALLER=Overte-Interface-x86_64-$RELEASE_NUMBER-${{ steps.buildenv1.outputs.github_sha_short }}.$INSTALLER_EXT" >> $GITHUB_ENV
|
|
fi
|
|
- 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: 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 "Updating apt repository index"
|
|
sudo apt update || exit 1
|
|
|
|
echo "Installing apt packages"
|
|
sudo apt install -y ${{ matrix.apt-dependencies }} || exit 1
|
|
|
|
echo "Installing Python Modules"
|
|
pip3 install boto3 || exit 1
|
|
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 application
|
|
working-directory: ${{runner.workspace}}/build
|
|
shell: bash
|
|
run: cmake --build . --config $BUILD_TYPE --target $APP_TARGET_NAME $CMAKE_BUILD_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 console
|
|
working-directory: ${{runner.workspace}}/build
|
|
shell: bash
|
|
run: cmake --build . --config $BUILD_TYPE --target packaged-server-console $CMAKE_BUILD_EXTRA
|
|
|
|
- name: Build installer
|
|
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: 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 artifact
|
|
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macOS')
|
|
shell: bash
|
|
working-directory: ${{runner.workspace}}/build
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.s3_access_key_id }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.s3_secret_access_key }}
|
|
run: $PYTHON_EXEC $GITHUB_WORKSPACE/tools/ci-scripts/upload.py
|