Skip to content

Windows Develop Workflow (HoloLens Builds) #50

Windows Develop Workflow (HoloLens Builds)

Windows Develop Workflow (HoloLens Builds) #50

name: Windows Develop Workflow (HoloLens Builds)
on:
workflow_dispatch:
schedule:
- cron: 0 19 * * 5
jobs:
build_unity:
name: Build Unity project
runs-on: windows-2019
outputs:
buildVersion: ${{ steps.buildStep.outputs.buildVersion }}
steps:
# Activation stage
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: 'true'
ref: develop
- name: LFS pull
run: git lfs pull
- name: Set up IBM Watson credentials
env:
ASSISTANTKEYS: ${{ secrets.ASSISTANTKEYS }}
OAIKEYS: ${{ secrets.OAISECRET }}
SENTRYCFG: ${{ secrets.SENTRYCFG }}
SENTRYCLI: ${{ secrets.SENTRYCLI }}
run: |
echo -n "$env:ASSISTANTKEYS" > $env:GITHUB_WORKSPACE/ibm-credentials.env
echo "path of the credentials resource $env:GITHUB_WORKSPACE/Assets/Resources/ibm-credentials.txt"
$env:IBM_CREDENTIALS_FILE="$env:GITHUB_WORKSPACE/ibm-credentials.env"
echo -n "$env:OAIKEYS" > $env:GITHUB_WORKSPACE/Assets/Resources/openai.txt
echo "path of the OAI credentials resource $env:GITHUB_WORKSPACE/Assets/Resources/openai.txt"
echo -n "$env:SENTRYCFG" > $env:GITHUB_WORKSPACE/Assets/Resources/Sentry/SentryOptions.asset
echo "path of the Sentry options yaml file $env:GITHUB_WORKSPACE/Assets/Resources/Sentry/SentryOptions.asset"
echo -n "$env:SENTRYCLI" > $env:GITHUB_WORKSPACE/Assets/Plugins/Sentry/SentryCliOptions.asset
echo "path of the Sentry CLI options yaml file $env:GITHUB_WORKSPACE/Assets/Plugins/Sentry/SentryCliOptions.asset"
$env:TARGET_PLATFORM="Hololens"
# Cache
- name: Caching
uses: actions/cache@v3
with:
path: Library
key: Library-buildWindows-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-buildWindows-
# - name: Determine version manually
# run: |
# chmod +x ./ci/get_version.sh && APP_VERSION=`./ci/get_version.sh` && export APP_VERSION
# echo -n $APP_VERSION > version.txt
# Build stage
- name: Unity builder
uses: game-ci/unity-builder@v3
id: buildStep
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL_ED }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD_ED }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_ED }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
targetPlatform: WSAPlayer
unityVersion: 2022.3.7f1
versioning: Semantic
# dirty build needed to include generated Watson credentials
allowDirtyBuild: true
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: WSAPlayer
path: build/WSAPlayer
retention-days: 90
if-no-files-found: error
build_hololens:
name: Build Hololens
runs-on: windows-2019
needs: build_unity
outputs:
browser_download_url: ${{ steps.releaseUpload.outputs.browser_download_url }}
strategy:
fail-fast: false
matrix:
include:
- hlversion: 2
hlplatform: ARM64
env:
HLVERSION: ${{ matrix.hlversion }}
HLPLATFORM: ${{ matrix.hlplatform }}
JobID: ${{ github.event.release.body }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
lfs: 'true'
ref: develop
- name: LFS pull
run: git lfs pull
- name: Set up IBM Watson credentials
env:
ASSISTANTKEYS: ${{ secrets.ASSISTANTKEYS }}
OAIKEYS: ${{ secrets.OAISECRET }}
SENTRYCFG: ${{ secrets.SENTRYCFG }}
SENTRYCLI: ${{ secrets.SENTRYCLI }}
run: |
echo -n "$env:ASSISTANTKEYS" > $env:GITHUB_WORKSPACE/ibm-credentials.env
echo "path of the credentials resource $env:GITHUB_WORKSPACE/Assets/Resources/ibm-credentials.txt"
$env:IBM_CREDENTIALS_FILE="$env:GITHUB_WORKSPACE/ibm-credentials.env"
echo -n "$env:OAIKEYS" > $env:GITHUB_WORKSPACE/Assets/Resources/openai.txt
echo "path of the OAI credentials resource $env:GITHUB_WORKSPACE/Assets/Resources/openai.txt"
echo -n "$env:SENTRYCFG" > $env:GITHUB_WORKSPACE/Assets/Resources/Sentry/SentryOptions.asset
echo "path of the Sentry options yaml file $env:GITHUB_WORKSPACE/Assets/Resources/Sentry/SentryOptions.asset"
echo -n "$env:SENTRYCLI" > $env:GITHUB_WORKSPACE/Assets/Plugins/Sentry/SentryCliOptions.asset
echo "path of the Sentry CLI options yaml file $env:GITHUB_WORKSPACE/Assets/Plugins/Sentry/SentryCliOptions.asset"
$env:TARGET_PLATFORM="Hololens"
- name: Setup Unity UWP
uses: kuler90/setup-unity@v1
with:
unity-modules: universal-windows-platform
- name: Setup developer command prompt for Microsoft Visual C++
uses: ilammy/msvc-dev-cmd@v1
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Download WSAPlayer Artifact
uses: actions/download-artifact@v2
with:
name: WSAPlayer
path: build/WSAPlayer
- name: Execute msbuild
run: '& "msbuild.exe" build\WSAPlayer\WSAPlayer\MirageXR.sln -maxcpucount:2 /p:Configuration=Release /p:Platform=$env:HLPLATFORM /p:AppxBundle="Always" /p:AppxBundlePlatforms=$env:HLPLATFORM /p:UseSubFolderForOutputDirDuringMultiPlatformBuild=false'
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: hololens${{ matrix.hlversion }}
path: |
build/WSAPlayer/WSAPlayer/AppPackages/MirageXR/**/*.appxbundle
build/WSAPlayer/WSAPlayer/AppPackages/MirageXR/**/Dependencies/${{ matrix.hlplatform }}/*.appx
retention-days: 90
- name: Build zip for release only
uses: vimtor/action-zip@v1
if: github.event.release && github.event.action == 'published'
with:
files: |
build/WSAPlayer/WSAPlayer/AppPackages/MirageXR/**/*.appxbundle
build/WSAPlayer/WSAPlayer/AppPackages/MirageXR/**/Dependencies/${{ matrix.hlplatform }}/*.appx
dest: build/hololens${{ matrix.hlversion }}.zip
- name: Upload Zip to GitHub Release
uses: svenstaro/upload-release-action@v2
id: releaseUpload
if: github.event.release && github.event.action == 'published'
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
asset_name: hololens${{ matrix.hlversion }}.zip
file: build/hololens${{ matrix.hlversion }}.zip
tag: ${{ github.ref }}
overwrite: false
body: ${{ github.event.release.body }}
# Deploy stage
prerelease-notification:
name: Prerelease Slack notification
runs-on: ubuntu-latest
needs: [build_unity, build_hololens]
if: github.ref == 'refs/heads/develop' && !github.event.pull_request
env:
SLACK_URL: ${{ secrets.SLACK_URL }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
APP_VERSION: ${{ needs.build_unity.outputs.buildVersion }}
TARGET_PLATFORM: $RUNNER_OS
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Post notification
run: |
echo $APP_VERSION
sudo apt-get update && sudo apt-get -y install curl
chmod +x ./ci/notify-preview.sh && ./ci/notify-preview.sh