Gha build appimage #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2013-2019 High Fidelity, Inc. | |
# Copyright 2020-2022 Vircadia contributors. | |
# Copyright 2021-2023 Overte e.V. | |
# SPDX-License-Identifier: Apache-2.0 | |
name: Linux AppImage build | |
# This was made for a particular self-hosted setup containing helper scripts. | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, labeled] | |
push: | |
branches: | |
- master | |
defaults: | |
run: | |
shell: bash | |
env: | |
BUILD_TYPE: Release | |
# Sentry Crash Reporting | |
CMAKE_BACKTRACE_URL: ${{ secrets.SENTRY_MINIDUMP_ENDPOINT }} | |
CMAKE_BACKTRACE_TOKEN: AppImage_${{ github.event.number }}_${{ github.sha }} | |
jobs: | |
build: | |
name: "${{matrix.os}}, ${{matrix.arch}}" | |
strategy: | |
matrix: | |
include: | |
- os: Ubuntu 20.04 | |
runner: AppImage | |
arch: amd64 | |
fail-fast: true | |
runs-on: ${{matrix.runner}} | |
steps: | |
- name: Clear Working Directories | |
shell: bash | |
run: | | |
mkdir -p appimage | |
cd appimage | |
if [ -d "overte-builder" ] ; then | |
rm -rf "overte-builder" | |
fi | |
- name: Download Overte Builder | |
shell: bash | |
working-directory: appimage | |
run: | | |
git clone https://github.com/overte-org/overte-builder.git | |
- name: Build AppImage | |
shell: bash | |
working-directory: appimage | |
run: | | |
basedir=`pwd` | |
overtedir="$basedir/Overte" | |
if [ -d "$overtedir" ] ; then | |
# Get rid of any existing AppImage | |
echo Cleaning up previous AppImages | |
rm -v $overtedir/*AppImage || true | |
fi | |
if [ -z "$CMAKE_BACKTRACE_URL" ] ; then | |
# We're building a PR, default to the PR endpoint | |
echo "Setting up crash reporting for a PR" | |
export CMAKE_BACKTRACE_URL="https://o4504831972343808.ingest.sentry.io/api/4504832427950080/minidump/?sentry_key=f511de295975461b8f92a36f4a4a4f32" | |
export CMAKE_BACKTRACE_TOKEN="AppImage_pr_${{ github.event.number }}_${{ github.sha }}" | |
fi | |
cd overte-builder | |
./overte-builder --auto --make-appimage --destdir="$overtedir" | |
# Warning: We generate an appimage/Overte/Overte.AppImage directory which is then | |
# used to generate the actual AppImage. We don't want to upload that as an artifact, | |
# as that's what's inside the AppImage files anyway. | |
# | |
# We tailor the path pattern to exclude it, but we'll also remove it for good measure. | |
- name: Remove unneeded AppImage directory | |
shell: bash | |
working-directory: appimage | |
run: | | |
if [ -d "Overte/Overte.AppImage" ] ; then | |
rm -rf "Overte/Overte.AppImage" | |
fi | |
- name: Upload AppImage without debug info to GitHub | |
if: contains( github.event.pull_request.labels.*.name, 'upload_to_github') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Overte-nodebug-x86_64.AppImage | |
path: appimage/Overte/Overte-*-nodebug-x86_64.AppImage | |
- name: Upload AppImage with debug info to GitHub | |
if: contains( github.event.pull_request.labels.*.name, 'upload_to_github') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Overte-x86_64.AppImage | |
path: | | |
appimage/Overte/Overte-*-debug-x86_64.AppImage | |
- name: Upload AppImage without debugging to S3 | |
if: contains( github.event.pull_request.labels.*.name, 'upload_to_github') == false | |
shell: bash | |
working-directory: appimage | |
run: | | |
if [ ! -x "/usr/local/bin/upload_to_s3" ] ; then | |
echo "Couldn't find /usr/local/bin/upload_to_s3 upload script. Label this with upload_to_github to upload to GitHub instead." | |
exit 1 | |
fi | |
filename=`find Overte -maxdepth 1 -name 'Overte-*-nodebug-x86_64.AppImage'` | |
base=`basename "$filename"` | |
sudo -u uploader /usr/local/bin/upload_to_s3 --type "${{ github.event_name }}" --number ${{ github.event.number }} --name "$base" < "$filename" | |
- name: Upload AppImage with debugging to S3 | |
if: contains( github.event.pull_request.labels.*.name, 'upload_to_github') == false | |
shell: bash | |
working-directory: appimage | |
run: | | |
if [ ! -x "/usr/local/bin/upload_to_s3" ] ; then | |
echo "Couldn't find /usr/local/bin/upload_to_s3 upload script. Label this with upload_to_github to upload to GitHub instead." | |
exit 1 | |
fi | |
filename=`find Overte -maxdepth 1 -name 'Overte-*-debug-x86_64.AppImage'` | |
base=`basename "$filename"` | |
sudo -u uploader /usr/local/bin/upload_to_s3 --type "${{ github.event_name }}" --number ${{ github.event.number }} --name "$base" < "$filename" | |
- name: Cleanup | |
if: ${{ always() }} | |
shell: bash | |
working-directory: appimage | |
run: | | |
rm -rf Overte/*AppImage Overte/build | |
- name: Output system stats | |
if: ${{ always() }} | |
shell: bash | |
run: | | |
echo "Disk usage:" | |
df -h | |