Skip to content

Bump code/mobile/android/PhoneVR/ALVR from d4a476d to ac23410 #120

Bump code/mobile/android/PhoneVR/ALVR from d4a476d to ac23410

Bump code/mobile/android/PhoneVR/ALVR from d4a476d to ac23410 #120

Workflow file for this run

name: CI
env:
MAIN_PROJECT_MODULE: app
PROJECT_NAME: PhoneVR
SOLUTION_FILE_PATH: code\windows\PhoneVR\PhoneVR.sln
SOLUTION_DIR: code\windows\PhoneVR\
GRADLE_DIR: code/mobile/android/PhoneVR
ORG_FULL: PhoneVR-Developers/PhoneVR
permissions:
checks: write
pull-requests: write
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
# defaults:
# run:
# working-directory: code/mobile/android/PhoneVR
jobs:
Build_PVR_Server:
name: Build PhoneVR Server
strategy:
fail-fast: false
matrix:
config: [Release, Debug]
platform: [x64, x86]
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "16.0.0"
- name: Clang-format check
shell: bash
run: |
clang-format --version
make format-check
# https://github.com/actions/runner-images/issues/842#issuecomment-1495115166
- name: Install MSVC 2015 (v140) and Windows 8.1 SDK
shell: powershell
run: |
$VS_BTOOLS_EXE="vs_buildtools.exe"
$VS_BTOOLS_URI="https://aka.ms/vs/15/release/vs_buildtools.exe"
Invoke-WebRequest -Uri $VS_BTOOLS_URI -OutFile $VS_BTOOLS_EXE
Start-Process -FilePath ./vs_BuildTools.exe -ArgumentList `
"--add", "Microsoft.VisualStudio.Component.VC.140", `
"--add", "Microsoft.VisualStudio.Component.Windows81SDK", `
"--quiet", "--norestart", "--force", "--wait" -Wait -PassThru
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}
- name: Building ${{matrix.platform}}-${{matrix.config}}
working-directory: ${{env.GITHUB_WORKSPACE}}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{matrix.config}} /p:Platform=${{matrix.platform}} ${{env.SOLUTION_FILE_PATH}}
- name: Upload Build outputs
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME }}-Server-${{ matrix.config }}
path: ${{ env.SOLUTION_DIR }}\${{ matrix.config }}
Build_APK:
name: Build Android APK
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
# Set Current Date As Env Variable
- name: Set current date as env variable
id: vars
shell: bash
run: |
echo "date_today=$(date +'%Y-%m-%d')" >> "$GITHUB_ENV"
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: '17'
# Only for Testing github-actions
- uses: actions-rs/toolchain@v1
if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: Swatinem/rust-cache@v2
if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
with:
cache-on-failure: true
workspaces: ${{env.GRADLE_DIR}}/ALVR/
- uses: gradle/gradle-build-action@v2
if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
with:
build-root-directory: ${{env.GRADLE_DIR}}
cache-read-only: ${{ false }}
- name: Prepare deps
run: |
ls -alh
cd code/mobile/android/PhoneVR
chmod +x prepare-alvr-deps.sh
bash prepare-alvr-deps.sh
- name: Change gradle wrapper permissions
run: |
cd code/mobile/android/PhoneVR
chmod +x ./gradlew
ls -alh
ls -alh app
# Create APK Debug
- name: Build apk debug project (APK)
run: |
cd code/mobile/android/PhoneVR
./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleDebug --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# Create APK Release
- name: Build apk release project (APK)
env:
Key: ${{ secrets.KEY }}
Store: ${{ secrets.STORE }}
run: |
cd code/mobile/android/PhoneVR
./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assemble --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# Upload Artifact Build
# Noted For Output [MAIN_PROJECT_MODULE]/build/outputs/apk/debug/
- name: Upload APK Debug
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME }}-debug-${{ steps.vars.outputs.sha_short }}-${{ env.date_today }} APK
path: ${{env.GRADLE_DIR}}/${{ env.MAIN_PROJECT_MODULE }}/build/outputs/apk/debug/
# Noted For Output [MAIN_PROJECT_MODULE]/build/outputs/apk/release/
- name: Upload APK Release
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME }}-${{ steps.vars.outputs.sha_short }}-${{ env.date_today }} APK
path: ${{env.GRADLE_DIR}}/${{ env.MAIN_PROJECT_MODULE }}/build/outputs/apk/release/
- name: Upload Build outputs on failure
if: failure()
uses: actions/upload-artifact@v2
with:
name: build-files
path: ${{ env.GRADLE_DIR }}/app/.cxx/
Test_APK:
name: Test APK
runs-on: macos-latest
env:
EMU_OPTS: -no-window -gpu swiftshader_indirect -no-boot-anim -camera-back virtualscene # -verbose -noaudio
EMU_PROFILE: pixel_2
EMU_AVD_NAME: Pixel_2
EMU_TARGET: playstore # google_apis
EMU_TIMEOUT: 1200
strategy:
matrix:
api-level: [30] # 29
steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: 17
# https://github.com/iterative/cml/issues/1377
- uses: actions/setup-node@v3
with:
node-version: '16'
# Only for Testing github-actions
- uses: actions-rs/toolchain@v1
if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
with:
profile: minimal
toolchain: stable
override: true
components: clippy
- uses: Swatinem/rust-cache@v2
if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
with:
cache-on-failure: true
workspaces: ${{env.GRADLE_DIR}}/ALVR/
- uses: gradle/gradle-build-action@v2
if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
with:
build-root-directory: ${{env.GRADLE_DIR}}
cache-read-only: ${{ false }}
# - name: AVD cache
# uses: actions/cache@v3
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-${{ matrix.api-level }}
# Create AVD with some redundancy - 3 Checks
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
id: avd_create_1
continue-on-error: true
with:
working-directory: ${{env.GRADLE_DIR}}
api-level: ${{ matrix.api-level }}
target: ${{ env.EMU_TARGET }}
force-avd-creation: false
emulator-options: ${{ env.EMU_OPTS }}
disable-animations: false
profile: ${{ env.EMU_PROFILE }}
avd-name: ${{ env.EMU_AVD_NAME }}
emulator-boot-timeout: ${{ env.EMU_TIMEOUT }}
script: echo "Generated AVD snapshot for caching."
- name: create AVD and generate snapshot for caching try#2
if: steps.avd-cache.outputs.cache-hit != 'true' && steps.avd_create_1.outcome == 'failure'
uses: reactivecircus/android-emulator-runner@v2
id: avd_create_2
continue-on-error: true
with:
working-directory: ${{env.GRADLE_DIR}}
api-level: ${{ matrix.api-level }}
target: ${{ env.EMU_TARGET }}
force-avd-creation: false
emulator-options: ${{ env.EMU_OPTS }}
disable-animations: false
profile: ${{ env.EMU_PROFILE }}
avd-name: ${{ env.EMU_AVD_NAME }}
emulator-boot-timeout: ${{ env.EMU_TIMEOUT }}
script: echo "Generated AVD snapshot for caching."
- name: create AVD and generate snapshot for caching try#3
if: steps.avd-cache.outputs.cache-hit != 'true' && steps.avd_create_2.outcome == 'failure'
uses: reactivecircus/android-emulator-runner@v2
id: avd_create_3
# continue-on-error: true # Fail, if failed in the 3rd try
with:
working-directory: ${{env.GRADLE_DIR}}
api-level: ${{ matrix.api-level }}
target: ${{ env.EMU_TARGET }}
force-avd-creation: false
emulator-options: ${{ env.EMU_OPTS }}
disable-animations: false
profile: ${{ env.EMU_PROFILE }}
avd-name: ${{ env.EMU_AVD_NAME }}
emulator-boot-timeout: ${{ env.EMU_TIMEOUT }}
script: echo "Generated AVD snapshot for caching."
# Redundancy End
- name: Prepare deps
shell: bash
run: |
ls -alh
cd code/mobile/android/PhoneVR
chmod +x prepare-alvr-deps.sh
bash prepare-alvr-deps.sh
- name: Change gradle wrapper permissions
run: |
echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini # OpenGL3 Support on AVDs
cat ~/.android/advancedFeatures.ini
cd code/mobile/android/PhoneVR
chmod +x ./gradlew
ls -alh
ls -alh app
# Cache APK gradle tasks
- name: Build apk debug project (APK)
run: |
cd code/mobile/android/PhoneVR
./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleDebug --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
- name: Start PVR ADB-Telnet Server
working-directory: ${{env.GRADLE_DIR}}/app/src/androidTest/java/viritualisres/phonevr/utils/
run: |
brew install telnet
chmod +x pvr-adb-telnet.sh
bash pvr-adb-telnet.sh >> log.txt 2>&1 &
# - name: Install recorder and record session
# env:
# SUFFIX: ${{ matrix.api-level }}
# run: |
# # brew install glfw3
# # brew install glew
# # brew install glxinfo
# # glxinfo | grep -i opengl
# brew install ffmpeg
# ffmpeg -f avfoundation -i 0 -t 840 out_API$SUFFIX.mov &
## Create AVD with some redundancy - 3 Checks
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
id: avd_run_1
continue-on-error: true
with:
working-directory: ${{env.GRADLE_DIR}}
api-level: ${{ matrix.api-level }}
target: ${{ env.EMU_TARGET }}
force-avd-creation: false
emulator-options: ${{ env.EMU_OPTS }}
disable-animations: true
profile: ${{ env.EMU_PROFILE }}
avd-name: ${{ env.EMU_AVD_NAME }}
emulator-boot-timeout: ${{ env.EMU_TIMEOUT }}
script: |
adb shell settings put secure immersive_mode_confirmations confirmed
adb shell "logcat -b all -v color" &
./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb logcat -b all > logcat.log
jobs -p | xargs kill
# adb bugreport bugreport.zip # hangs indef here
- name: Run tests try#2
uses: reactivecircus/android-emulator-runner@v2
if: steps.avd_run_1.outcome == 'failure'
id: avd_run_2
continue-on-error: true
with:
working-directory: ${{env.GRADLE_DIR}}
api-level: ${{ matrix.api-level }}
target: ${{ env.EMU_TARGET }}
force-avd-creation: false
emulator-options: ${{ env.EMU_OPTS }}
disable-animations: true
profile: ${{ env.EMU_PROFILE }}
avd-name: ${{ env.EMU_AVD_NAME }}
emulator-boot-timeout: ${{ env.EMU_TIMEOUT }}
script: |
adb shell settings put secure immersive_mode_confirmations confirmed
adb shell "logcat -b all -v color" &
./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb logcat -b all > logcat.log
jobs -p | xargs kill
# adb bugreport bugreport.zip # hangs indef here
- name: Run tests try#3
uses: reactivecircus/android-emulator-runner@v2
if: steps.avd_run_2.outcome == 'failure'
id: avd_run_3
# continue-on-error: true # Fail if even fail the 3rd try
with:
working-directory: ${{env.GRADLE_DIR}}
api-level: ${{ matrix.api-level }}
target: ${{ env.EMU_TARGET }}
force-avd-creation: false
emulator-options: ${{ env.EMU_OPTS }}
disable-animations: true
profile: ${{ env.EMU_PROFILE }}
avd-name: ${{ env.EMU_AVD_NAME }}
emulator-boot-timeout: ${{ env.EMU_TIMEOUT }}
script: |
adb shell settings put secure immersive_mode_confirmations confirmed
adb shell "logcat -b all -v color" &
./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb logcat -b all > logcat.log
jobs -p | xargs kill
# adb bugreport bugreport.zip # hangs indef here
## Redundancy End
- name: Shutdown PVR ADB-Telnet Server and log
working-directory: ${{env.GRADLE_DIR}}/app/src/androidTest/java/viritualisres/phonevr/utils/
if: always()
run: |
echo "shutdown meow !" >> pvr-adb-telnet.sd
cat log.txt
# build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/GPlay_Pixel_2_API_30(AVD) - 11/ALVRActivityTest_saveDeviceScreenBitmap.png
- uses: actions/upload-artifact@v3
if: always()
with:
name: Test results
path: |
**/app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/*
**/app/build/reports
**/app/build/test-results
**/app/build/outputs/androidTest-results
${{env.GRADLE_DIR}}/logcat.log
./*.mov
${{env.GRADLE_DIR}}/bugreport.zip
# app\build\outputs\androidTest-results\connected\TEST-GPlay_Pixel_2_API_30(AVD) - 11-_app-.xml
- name: Publish Test Results in Comment
uses: EnricoMi/publish-unit-test-result-action/composite@v2
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always()
if: github.event_name == 'pull_request' && always()
with:
report_individual_runs: true
report_suite_logs: 'any'
deduplicate_classes_by_file_name: true
comment_title: '🛠 Test Results'
files: |
code/mobile/android/PhoneVR/app/build/outputs/androidTest-results/**/TEST-*.xml
- uses: iterative/setup-cml@v1
if: github.event_name == 'pull_request' && always()
- name: Publish Screenshots - Find Comment
if: github.event_name == 'pull_request' && always()
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: '# 📷 Screenshots of tests:'
direction: last
comment-author: 'github-actions[bot]'
- name: Publish Screenshots - build comment
if: github.event_name == 'pull_request' && always()
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EVENT: ${{ github.event_name }}
REF: ${{ github.ref }}
WK_DIR: ${{env.GRADLE_DIR}}
shell: bash
working-directory: ${{env.GRADLE_DIR}}
run: |
brew install gnu-sed # There are differences between default sed on MacOS and Linux (gnuSed)
echo "# 📷 Screenshots of tests:" >> comment.md
echo "" >> comment.md
# ls -alh
# ls -alh app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/
# stat 'app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/Pixel_2(AVD) - 11/InitActivityTest_saveDeviceScreenBitmap.png'
# for each AVD Image
for ss_test_avd in app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/*; do
ls -alh "$ss_test_avd"
echo "$ss_test_avd"
ss_test_avd_desc=$(basename "$ss_test_avd")
echo "" >> comment.md
echo "### 📱 $ss_test_avd_desc" >> comment.md
echo "" >> comment.md
# for each .png in that AVD folder
for ss_test in "app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/$ss_test_avd_desc/"*.png; do
ss_test_desc=$(basename "$ss_test" .png)
echo "" >> comment.md
echo "#### 🔧 $ss_test_desc" >> comment.md
echo "" >> comment.md
echo "$WK_DIR + / + $ss_test"
echo '<p float="left">' >> comment.md
cml-publish "$ss_test" | gsed -E 's/.+/<img width="70%" src="\0"\/>/' >> comment.md
echo '</p>' >> comment.md
done
done
if [ "$EVENT" == 'pull_request' ]
then
sha=${{ github.event.pull_request.head.sha}}
elif [ "$EVENT" == 'workflow_run' ]
then
sha=${{ github.event.workflow_run.head_sha}}
else
sha=$GITHUB_SHA
fi
echo "" >> comment.md
echo "###### For commit $sha" >> comment.md
- name: Publish Screehnshots - Update or Create Comment
if: github.event_name == 'pull_request' && always()
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
body-file: ${{env.GRADLE_DIR}}/comment.md
edit-mode: replace
issue-number: ${{ github.event.number }}
# - name: Save AVD Cache
# uses: actions/cache/save@v3
# if: always() && !steps.avd-cache.outputs.cache-hit
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-${{ matrix.api-level }}
# Test_APK_Linux:
# name: Test APK Linux
# runs-on: ubuntu-latest
# env:
# EMU_OPTS: -no-window -gpu swiftshader_indirect -no-boot-anim -verbose -camera-back virtualscene # -noaudio
# EMU_PROFILE: pixel_2
# EMU_AVD_NAME: Pixel_2
# EMU_TARGET: playstore # google_apis
# strategy:
# matrix:
# api-level: [30] # 29
# steps:
# - name: checkout
# uses: actions/checkout@v3
# with:
# submodules: 'true'
# - name: Set Up JDK
# uses: actions/setup-java@v3
# with:
# distribution: 'oracle'
# java-version: 17
# # Only for Testing github-actions
# - uses: actions-rs/toolchain@v1
# if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
# with:
# profile: minimal
# toolchain: stable
# override: true
# components: clippy
# - uses: Swatinem/rust-cache@v2
# if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
# with:
# cache-on-failure: true
# workspaces: ${{env.GRADLE_DIR}}/ALVR/
# - uses: gradle/gradle-build-action@v2
# if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
# with:
# build-root-directory: ${{env.GRADLE_DIR}}
# cache-read-only: ${{ false }}
# # - name: AVD cache
# # uses: actions/cache@v3
# # id: avd-cache
# # with:
# # path: |
# # ~/.android/avd/*
# # ~/.android/adb*
# # key: avd-${{ matrix.api-level }}
# ## Create AVD with some redundancy - 3 Checks
# - name: create AVD and generate snapshot for caching
# if: steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_create_1
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: false
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: echo "Generated AVD snapshot for caching."
# - name: create AVD and generate snapshot for caching try#2
# if: steps.avd-cache.outputs.cache-hit != 'true' && steps.avd_create_1.outcome == 'failure'
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_create_2
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: false
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: echo "Generated AVD snapshot for caching."
# - name: create AVD and generate snapshot for caching try#3
# if: steps.avd-cache.outputs.cache-hit != 'true' && steps.avd_create_2.outcome == 'failure'
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_create_3
# # continue-on-error: true # Fail if even fail the 3rd try
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: false
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: echo "Generated AVD snapshot for caching."
# ## Redundancy End
# - name: Prepare deps
# shell: bash
# run: |
# ls -alh
# cd code/mobile/android/PhoneVR
# chmod +x prepare-alvr-deps.sh
# bash prepare-alvr-deps.sh
# - name: Change gradle wrapper permissions
# run: |
# echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini # OpenGL3 Support on AVDs
# cat ~/.android/advancedFeatures.ini
# cd code/mobile/android/PhoneVR
# chmod +x ./gradlew
# ls -alh
# ls -alh app
# # Cache APK gradle tasks
# - name: Build apk debug project (APK)
# run: |
# cd code/mobile/android/PhoneVR
# ./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleDebug --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# - name: Start PVR ADB-Telnet Server
# working-directory: ${{env.GRADLE_DIR}}/app/src/androidTest/java/viritualisres/phonevr/utils/
# run: |
# brew install telnet
# chmod +x pvr-adb-telnet.sh
# bash pvr-adb-telnet.sh >> log.txt 2>&1 &
# - name: Install recorder and record session
# env:
# SUFFIX: ${{ matrix.api-level }}
# run: |
# brew install glfw3
# brew install glew
# # brew install glxinfo
# # glxinfo | grep -i opengl
# brew install ffmpeg
# ffmpeg -f avfoundation -i 0 -t 840 out_API$SUFFIX.mov &
# ## Create AVD with some redundancy - 3 Checks
# - name: Run tests
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_run_1
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: true
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: |
# adb shell "logcat -b all -v color" &
# ./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb shell "logcat -b all" >> logcat.log
# # adb bugreport bugreport.zip # hangs indef here
# - name: Run tests try#2
# uses: reactivecircus/android-emulator-runner@v2
# if: steps.avd_run_1.outcome == 'failure'
# id: avd_run_2
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: true
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: |
# adb shell "logcat -b all -v color" &
# ./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb shell "logcat -b all" >> logcat.log
# # adb bugreport bugreport.zip # hangs indef here
# - name: Run tests try#3
# uses: reactivecircus/android-emulator-runner@v2
# if: steps.avd_run_2.outcome == 'failure'
# id: avd_run_3
# # continue-on-error: true # Fail if even fail the 3rd try
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: true
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: |
# adb shell "logcat -b all -v color" &
# ./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb shell "logcat -b all" >> logcat.log
# # adb bugreport bugreport.zip # hangs indef here
# ## Redundancy End
# - name: Shutdown PVR ADB-Telnet Server and log
# working-directory: ${{env.GRADLE_DIR}}/app/src/androidTest/java/viritualisres/phonevr/utils/
# if: always()
# run: |
# echo "shutdown meow !" >> pvr-adb-telnet.sd
# cat log.txt
# # build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/GPlay_Pixel_2_API_30(AVD) - 11/ALVRActivityTest_saveDeviceScreenBitmap.png
# - uses: actions/upload-artifact@v3
# if: always()
# with:
# name: Test results
# path: |
# **/app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/*
# **/app/build/reports
# **/app/build/test-results
# **/app/build/outputs/androidTest-results
# ${{env.GRADLE_DIR}}/logcat.log
# ./*.mov
# ${{env.GRADLE_DIR}}/bugreport.zip
# # app\build\outputs\androidTest-results\connected\TEST-GPlay_Pixel_2_API_30(AVD) - 11-_app-.xml
# - name: Publish Test Results in Comment
# uses: EnricoMi/publish-unit-test-result-action/composite@v2
# # if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always()
# if: always()
# with:
# report_individual_runs: true
# report_suite_logs: 'any'
# deduplicate_classes_by_file_name: true
# comment_title: '🛠 Test Results'
# files: |
# code/mobile/android/PhoneVR/app/build/outputs/androidTest-results/**/TEST-*.xml
# # https://github.com/iterative/cml/issues/1377
# - uses: actions/setup-node@v3
# with:
# node-version: '16'
# - uses: iterative/setup-cml@v1
# if: always()
# - name: Publish Screenshots - Find Comment
# if: always()
# uses: peter-evans/find-comment@v2
# id: fc
# with:
# issue-number: ${{ github.event.number }}
# body-includes: '# 📷 Screenshots of tests:'
# direction: last
# comment-author: 'github-actions[bot]'
# - name: Publish Screenshots - build comment
# if: always()
# env:
# REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# EVENT: ${{ github.event_name }}
# REF: ${{ github.ref }}
# WK_DIR: ${{env.GRADLE_DIR}}
# shell: bash
# working-directory: ${{env.GRADLE_DIR}}
# run: |
# echo "# 📷 Screenshots of tests:" >> comment.md
# echo "" >> comment.md
# ls -alh
# ls -alh app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/
# stat 'app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/Pixel_2(AVD) - 11/InitActivityTest_saveDeviceScreenBitmap.png'
# # for each AVD Image
# for ss_test_avd in app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/*; do
# ls -alh "$ss_test_avd"
# echo "$ss_test_avd"
# ss_test_avd_desc=$(basename "$ss_test_avd")
# echo "" >> comment.md
# echo "### 📱 $ss_test_avd_desc" >> comment.md
# echo "" >> comment.md
# # for each .png in that AVD folder
# for ss_test in "app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/$ss_test_avd_desc/"*.png; do
# ss_test_desc=$(basename "$ss_test" .png)
# echo "#### 🔧 $ss_test_desc" >> comment.md
# echo "$WK_DIR + / + $ss_test"
# echo '<p float="left">' >> comment.md
# cml-publish "$ss_test" | sed -E 's/.+/<img width="90%" src="\0"\/>/' >> comment.md
# echo '</p>' >> comment.md
# done
# done
# if [ "$EVENT" == 'pull_request' ]
# then
# sha=${{ github.event.pull_request.head.sha}}
# elif [ "$EVENT" == 'workflow_run' ]
# then
# sha=${{ github.event.workflow_run.head_sha}}
# else
# sha=$GITHUB_SHA
# fi
# echo "" >> comment.md
# echo "###### For commit $sha" >> comment.md
# - name: Publish Screehnshots - Update or Create Comment
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always()
# uses: peter-evans/create-or-update-comment@v3
# with:
# comment-id: ${{ steps.fc.outputs.comment-id }}
# body-file: comment.md
# edit-mode: replace
# issue-number: ${{ github.event.number }}
# # - name: Save AVD Cache
# # uses: actions/cache/save@v3
# # if: always() && !steps.avd-cache.outputs.cache-hit
# # with:
# # path: |
# # ~/.android/avd/*
# # ~/.android/adb*
# # key: avd-${{ matrix.api-level }}
# Test_APK_Win:
# runs-on: windows-latest
# steps:
# - name: Test HyperV
# shell: powershell
# run: |
# Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V
# get-service | findstr vmcompute
# - name: Test emu
# shell: bash
# run: |
# $ANDROID_HOME\\emulator\\emulator -accel-check
# Test_APK_Win:
# name: Test APK Win
# runs-on: windows-latest
# env:
# EMU_OPTS: -no-window -gpu swiftshader_indirect -no-boot-anim -verbose -camera-back virtualscene # -noaudio
# EMU_PROFILE: pixel_2
# EMU_AVD_NAME: Pixel_2
# EMU_TARGET: google_apis_playstore # google_apis
# MATRIX_E_SDK: 30
# MATRIX_AVD: test_win
# strategy:
# matrix:
# api-level: [30] # 29
# steps:
# - uses: FedericoCarboni/setup-ffmpeg@v2
# id: setup-ffmpeg
# - run: |
# ffmpeg -f gdigrab -framerate 30 -i desktop -t 120 out_API$SUFFIX.mov &
# npm install --global nircmd
# nircmd --help
# shell: bash
# - name: Create Android emulator
# shell: bash
# run: |
# # brew install intel-haxm
# # Install AVD files
# echo "y" | $ANDROID_HOME\\tools\\bin\\sdkmanager.bat --install 'system-images;android-'$MATRIX_E_SDK';google_apis_playstore;x86' > /dev/null
# echo "y" | $ANDROID_HOME\\tools\\bin\\sdkmanager.bat --licenses > /dev/null
# echo Creating emulator
# $ANDROID_HOME\\tools\\bin\\avdmanager.bat create avd -n $MATRIX_AVD -d pixel --package 'system-images;android-'$MATRIX_E_SDK';google_apis_playstore;x86'
# $ANDROID_HOME\\emulator\\emulator -list-avds
# if false; then
# emulator_config=~\\.android\\avd\\$MATRIX_AVD.avd\\config.ini
# # The following madness is to support empty OR populated config.ini files,
# # the state of which is dependant on the version of the emulator used (which we don't control),
# # so let's be defensive to be safe.
# # Replace existing config (NOTE we're on MacOS so sed works differently!)
# # sed -i .bak 's/hw.lcd.density=.*/hw.lcd.density=420/' "$emulator_config"
# # sed -i .bak 's/hw.lcd.height=.*/hw.lcd.height=1920/' "$emulator_config"
# # sed -i .bak 's/hw.lcd.width=.*/hw.lcd.width=1080/' "$emulator_config"
# # Or, add new config
# if ! grep -q "hw.lcd.density" "$emulator_config"; then
# echo "hw.lcd.density=420" >> "$emulator_config"
# fi
# if ! grep -q "hw.lcd.height" "$emulator_config"; then
# echo "hw.lcd.height=1920" >> "$emulator_config"
# fi
# if ! grep -q "hw.lcd.width" "$emulator_config"; then
# echo "hw.lcd.width=1080" >> "$emulator_config"
# fi
# echo "Emulator settings ($emulator_config)"
# cat "$emulator_config"
# fi
# - name: Start Android emulator
# timeout-minutes: 30 # ~4min normal - 3x DOSafety
# env:
# SUFFIX: ${{ matrix.android_avd }}-eAPI-${{ matrix.android_emu_version }}-${{ matrix.os }}
# shell: bash
# run: |
# echo "Starting emulator and waiting for boot to complete...."
# ls -la $ANDROID_HOME\\emulator
# nohup $ANDROID_HOME\\tools\\emulator -avd $MATRIX_AVD -gpu swiftshader_indirect -no-audio -no-boot-anim -camera-back none -camera-front none -qemu -m 2048 2>&1 &
# $ANDROID_HOME\\platform-tools\\adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do echo "wait..."; sleep 1; done; input keyevent 82'
# echo "Emulator has finished booting"
# $ANDROID_HOME\\platform-tools\\adb devices
# sleep 30
# nircmd savescreenshot screenshot$SUFFIX.jpg
# $ANDROID_HOME\\platform-tools\\adb exec-out screencap -p > emulator$SUFFIX.png
# ls -alh
# - name: checkout
# uses: actions/checkout@v3
# with:
# submodules: 'true'
# - name: Set Up JDK
# uses: actions/setup-java@v3
# with:
# distribution: 'oracle'
# java-version: 17
# # Only for Testing github-actions
# - uses: actions-rs/toolchain@v1
# if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
# with:
# profile: minimal
# toolchain: stable
# override: true
# components: clippy
# - uses: Swatinem/rust-cache@v2
# if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
# with:
# cache-on-failure: true
# workspaces: ${{env.GRADLE_DIR}}/ALVR/
# - uses: gradle/gradle-build-action@v2
# if: ${{ github.event.pull_request.head.repo.full_name != '${{ env.ORG_FULL }}' }} # Only run if not on master repo
# with:
# build-root-directory: ${{env.GRADLE_DIR}}
# cache-read-only: ${{ false }}
# # - name: AVD cache
# # uses: actions/cache@v3
# # id: avd-cache
# # with:
# # path: |
# # ~/.android/avd/*
# # ~/.android/adb*
# # key: avd-${{ matrix.api-level }}
# ## Create AVD with some redundancy - 3 Checks
# - name: create AVD and generate snapshot for caching
# if: steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_create_1
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: false
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: echo "Generated AVD snapshot for caching."
# - name: create AVD and generate snapshot for caching try#2
# if: steps.avd-cache.outputs.cache-hit != 'true' && steps.avd_create_1.outcome == 'failure'
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_create_2
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: false
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: echo "Generated AVD snapshot for caching."
# - name: create AVD and generate snapshot for caching try#3
# if: steps.avd-cache.outputs.cache-hit != 'true' && steps.avd_create_2.outcome == 'failure'
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_create_3
# # continue-on-error: true # Fail if even fail the 3rd try
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: false
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: echo "Generated AVD snapshot for caching."
# ## Redundancy End
# - name: Prepare deps
# shell: bash
# run: |
# ls -alh
# cd code/mobile/android/PhoneVR
# chmod +x prepare-alvr-deps.sh
# bash prepare-alvr-deps.sh
# - name: Change gradle wrapper permissions
# run: |
# echo "GLESDynamicVersion = on" >> ~/.android/advancedFeatures.ini # OpenGL3 Support on AVDs
# cat ~/.android/advancedFeatures.ini
# cd code/mobile/android/PhoneVR
# chmod +x ./gradlew
# ls -alh
# ls -alh app
# # Cache APK gradle tasks
# - name: Build apk debug project (APK)
# run: |
# cd code/mobile/android/PhoneVR
# ./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleDebug --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# - name: Start PVR ADB-Telnet Server
# working-directory: ${{env.GRADLE_DIR}}/app/src/androidTest/java/viritualisres/phonevr/utils/
# run: |
# brew install telnet
# chmod +x pvr-adb-telnet.sh
# bash pvr-adb-telnet.sh >> log.txt 2>&1 &
# - name: Install recorder and record session
# env:
# SUFFIX: ${{ matrix.api-level }}
# run: |
# brew install glfw3
# brew install glew
# brew install glxinfo
# # glxinfo | grep -i opengl
# brew install ffmpeg
# ffmpeg -f avfoundation -i 0 -t 840 out_API$SUFFIX.mov &
# ## Create AVD with some redundancy - 3 Checks
# - name: Run tests
# uses: reactivecircus/android-emulator-runner@v2
# id: avd_run_1
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: true
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: |
# adb shell "logcat -b all -v color" &
# ./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb shell "logcat -b all" >> logcat.log
# - name: Run tests try#2
# uses: reactivecircus/android-emulator-runner@v2
# if: steps.avd_run_1.outcome == 'failure'
# id: avd_run_2
# continue-on-error: true
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: true
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: |
# adb shell "logcat -b all -v color" &
# ./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb shell "logcat -b all" >> logcat.log
# - name: Run tests try#3
# uses: reactivecircus/android-emulator-runner@v2
# if: steps.avd_run_2.outcome == 'failure'
# id: avd_run_3
# # continue-on-error: true # Fail if even fail the 3rd try
# with:
# working-directory: ${{env.GRADLE_DIR}}
# api-level: ${{ matrix.api-level }}
# target: ${{ env.EMU_TARGET }}
# force-avd-creation: false
# emulator-options: ${{ env.EMU_OPTS }}
# disable-animations: true
# profile: ${{ env.EMU_PROFILE }}
# avd-name: ${{ env.EMU_AVD_NAME }}
# script: |
# adb shell "logcat -b all -v color" &
# ./gradlew connectedCheck --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}}
# adb shell "logcat -b all" >> logcat.log
# ## Redundancy End
# - name: Get Bug Report & tombstones
# if: always()
# run: |
# adb bugreport bugreport.zip
# - name: Shutdown PVR ADB-Telnet Server and log
# working-directory: ${{env.GRADLE_DIR}}/app/src/androidTest/java/viritualisres/phonevr/utils/
# if: always()
# run: |
# echo "shutdown meow !" >> pvr-adb-telnet.sd
# cat log.txt
# build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/GPlay_Pixel_2_API_30(AVD) - 11/ALVRActivityTest_saveDeviceScreenBitmap.png
# **/app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/*
# **/app/build/reports
# **/app/build/test-results
# **/app/build/outputs/androidTest-results
# ${{env.GRADLE_DIR}}/logcat.log
# bugreport.zip
# - uses: actions/upload-artifact@v3
# if: always()
# with:
# name: Test results
# path: |
# .*.mov
# .*.png
# .*.jpg
# # app\build\outputs\androidTest-results\connected\TEST-GPlay_Pixel_2_API_30(AVD) - 11-_app-.xml
# - name: Publish Test Results in Comment
# uses: EnricoMi/publish-unit-test-result-action/composite@v2
# # if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always()
# if: always()
# with:
# report_individual_runs: true
# report_suite_logs: 'any'
# deduplicate_classes_by_file_name: true
# comment_title: '🛠 Test Results'
# files: |
# code/mobile/android/PhoneVR/app/build/outputs/androidTest-results/**/TEST-*.xml
# - uses: iterative/setup-cml@v1
# if: always()
# - name: Publish Screenshots - Find Comment
# if: always()
# uses: peter-evans/find-comment@v2
# id: fc
# with:
# issue-number: ${{ github.event.number }}
# body-includes: '# 📷 Screenshots of tests:'
# direction: last
# comment-author: 'github-actions[bot]'
# - name: Publish Screenshots - build comment
# if: always()
# env:
# REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# EVENT: ${{ github.event_name }}
# REF: ${{ github.ref }}
# WK_DIR: ${{env.GRADLE_DIR}}
# shell: bash
# working-directory: ${{env.GRADLE_DIR}}
# run: |
# echo "# 📷 Screenshots of tests:" >> comment.md
# echo "" >> comment.md
# ls -alh
# ls -alh app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/
# # for each AVD Image
# for ss_test_avd in app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/*; do
# ls -alh "$ss_test_avd"
# echo "$ss_test_avd"
# ss_test_avd_desc=$(basename "$ss_test_avd")
# echo "" >> comment.md
# echo "### 📱 $ss_test_avd_desc" >> comment.md
# echo "" >> comment.md
# # for each .png in that AVD folder
# for ss_test in "app/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/$ss_test_avd_desc/"*.png; do
# ss_test_desc=$(basename "$ss_test" .png)
# echo "#### 🔧 $ss_test_desc" >> comment.md
# echo "$WK_DIR/$ss_test"
# echo '<p float="left">' >> comment.md
# cml-publish "$WK_DIR/$ss_test" | sed -E 's/.+/<img width="90%" src="\0"\/>/' >> comment.md
# echo '</p>' >> comment.md
# done
# done
# if [ "$EVENT" == 'pull_request' ]
# then
# sha=${{ github.event.pull_request.head.sha}}
# elif [ "$EVENT" == 'workflow_run' ]
# then
# sha=${{ github.event.workflow_run.head_sha}}
# else
# sha=$GITHUB_SHA
# fi
# echo "" >> comment.md
# echo "###### For commit $sha" >> comment.md
# - name: Publish Screehnshots - Update or Create Comment
# if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always()
# uses: peter-evans/create-or-update-comment@v3
# with:
# comment-id: ${{ steps.fc.outputs.comment-id }}
# body-file: comment.md
# edit-mode: replace
# issue-number: ${{ github.event.number }}
# # - name: Save AVD Cache
# # uses: actions/cache/save@v3
# # if: always() && !steps.avd-cache.outputs.cache-hit
# # with:
# # path: |
# # ~/.android/avd/*
# # ~/.android/adb*
# # key: avd-${{ matrix.api-level }}