WIP: ARCore-based position tracking #497
Workflow file for this run
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
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 ] | |
repository_dispatch: | |
types: [ok-to-test-command] | |
workflow_dispatch: | |
# defaults: | |
# run: | |
# working-directory: code/mobile/android/PhoneVR | |
jobs: | |
Build_PVR_Server: | |
name: Build PhoneVR Server | |
if: github.event_name != 'repository_dispatch' | |
strategy: | |
fail-fast: false | |
matrix: | |
config: [Release, Debug] | |
platform: [x64, x86] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
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 2017 (v141) and Windows 8.1 SDK for MSVS2022 | |
shell: powershell | |
run: | | |
env | |
# tree "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools" /F - empty folder | |
# tree "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" /F - github-runners MSVS Installation folder | |
# VCTargetsPath="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\" where Microsoft.Cpp.Default.props resides | |
$VS_BTOOLS_EXE="vs_buildtools.exe" | |
$VS_BTOOLS_URI="https://aka.ms/vs/17/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.v141.x86.x64", ` | |
"--quiet", "--norestart", "--force", "--wait" -Wait -PassThru -nonewwindow | |
# 8.1 SDK is no longer available in latest github-runners and MSVS2022/2019 build tools | |
# have to download it manually like https://stackoverflow.com/a/77947878 | |
Invoke-WebRequest -Uri https://go.microsoft.com/fwlink/p/?LinkId=323507 -OutFile sdk81setup.exe | |
Start-Process -FilePath ./sdk81setup.exe -ArgumentList "/features +", "/q", "/norestart" -Wait -PassThru -nonewwindow | |
- name: Add MSBuild to PATH | |
uses: microsoft/[email protected] | |
with: | |
vs-version: '17' | |
- 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: | | |
env | |
$env:VCTargetsPath="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\" | |
env | |
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 | |
if: github.event_name != 'repository_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
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@v4 | |
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@v3 | |
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 nogvr | |
- 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 noGvr debug project (APK) | |
run: | | |
cd code/mobile/android/PhoneVR | |
./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleNoGvrDebug --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}} | |
# Create APK Release | |
- name: Build apk noGvr release project (APK) | |
env: | |
Key: ${{ secrets.KEY }} | |
Store: ${{ secrets.STORE }} | |
run: | | |
cd code/mobile/android/PhoneVR | |
./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleNoGvrRelease --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}} | |
- name: Prepare deps | |
run: | | |
ls -alh | |
cd code/mobile/android/PhoneVR | |
chmod +x prepare-alvr-deps.sh | |
bash prepare-alvr-deps.sh | |
# Create APK Debug | |
- name: Build apk gvr debug project (APK) | |
run: | | |
cd code/mobile/android/PhoneVR | |
./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleGvrDebug --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}} | |
# Create APK Release | |
- name: Build apk gvr release project (APK) | |
env: | |
Key: ${{ secrets.KEY }} | |
Store: ${{ secrets.STORE }} | |
run: | | |
cd code/mobile/android/PhoneVR | |
./gradlew :${{ env.MAIN_PROJECT_MODULE }}:assembleGvrRelease --warning-mode=all --stacktrace -Dorg.gradle.java.home=${{env.JAVA_HOME}} | |
# Upload Artifact Build | |
# Noted For Output [MAIN_PROJECT_MODULE]/build/outputs/apk/gvr/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/gvr/debug/ | |
# Noted For Output [MAIN_PROJECT_MODULE]/build/outputs/apk/gvr/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/gvr/release/ | |
# Noted For Output [MAIN_PROJECT_MODULE]/build/outputs/apk/noGvr/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/noGvr/debug/ | |
# Noted For Output [MAIN_PROJECT_MODULE]/build/outputs/apk/noGvr/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/noGvr/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: ubuntu-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 | |
# Can specify arch here as x86_64, but need x86 for GVR Testing | |
strategy: | |
matrix: | |
api-level: [30] # 29 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
if: github.event_name != 'repository_dispatch' | |
with: | |
submodules: 'true' | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: true | |
android: false | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
# https://github.com/ReactiveCircus/android-emulator-runner/pull/366 | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
# Check out merge commit for Signed Pull Request | |
- name: Fork based /ok-to-test checkout | |
uses: actions/checkout@v4 | |
if: | | |
github.event_name == 'repository_dispatch' && | |
github.event.client_payload.slash_command.args.named.sha != '' && | |
contains( | |
github.event.client_payload.pull_request.head.sha, | |
github.event.client_payload.slash_command.args.named.sha | |
) | |
with: | |
ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge' | |
submodules: 'true' | |
# - name: Test | |
# run: | | |
# cat $GITHUB_ENV | |
# cat $GITHUB_PATH | |
# echo $GITHUB_ENV | |
# echo $GITHUB_PATH | |
# echo $PATH | |
# echo "ANDROID_NDK=/Users/runner/Library/Android/sdk/ndk/25.2.9519653" >> $GITHUB_ENV | |
# echo "ANDROID_NDK_HOME=/Users/runner/Library/Android/sdk/ndk/25.2.9519653" >> $GITHUB_ENV | |
# echo "ANDROID_NDK_LATEST_HOME=/Users/runner/Library/Android/sdk/ndk/25.2.9519653" >> $GITHUB_ENV | |
# echo "ANDROID_NDK_ROOT=/Users/runner/Library/Android/sdk/ndk/25.2.9519653" >> $GITHUB_ENV | |
# echo $PATH | |
- name: Set Up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: 17 | |
# https://github.com/iterative/cml/issues/1377 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- uses: android-actions/setup-android@v3 | |
with: | |
packages: 'platforms;android-30' | |
# 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@v3 | |
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@v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }}-${{ env.EMU_TARGET }}-${{ env.EMU_PROFILE }}-${{ env.EMU_AVD_NAME }} # Make sure you have the same key while saving in below step | |
- name: create AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
id: avd_create | |
uses: Wandalen/[email protected] | |
with: | |
action: reactivecircus/android-emulator-runner@v2 | |
attempt_limit: 5 | |
attempt_delay: 1000 # ms | |
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: Prepare deps | |
shell: bash | |
run: | | |
ls -alh | |
cd code/mobile/android/PhoneVR | |
chmod +x prepare-alvr-deps.sh | |
sudo apt update | |
sudo apt install libclang-dev | |
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: | | |
export ANDROID_SDK_ROOT=~/Library/Android/sdk | |
adb version | |
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 & | |
## Run tests with some redundancy - 5 Checks | |
- name: Run tests | |
uses: Wandalen/[email protected] | |
with: | |
action: reactivecircus/android-emulator-runner@v2 | |
attempt_limit: 5 | |
attempt_delay: 1000 # ms | |
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 | |
./gradlew :app:uninstallAll | |
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 | |
trap 'kill $(jobs -pr)' INT TERM EXIT | |
# adb bugreport bugreport.zip # hangs indef here | |
- 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/gvrDebugAndroidTest/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/gvrDebugAndroidTest/connected/* | |
**/app/build/outputs/connected_android_test_additional_output/noGvrDebugAndroidTest/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/macos@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 | |
- name: Publish Test Results in Comment (Signed) | |
uses: EnricoMi/publish-unit-test-result-action/macos@v2 | |
if: | | |
github.event_name == 'repository_dispatch' && | |
github.event.client_payload.slash_command.args.named.sha != '' && | |
contains( | |
github.event.client_payload.pull_request.head.sha, | |
github.event.client_payload.slash_command.args.named.sha | |
) && always() | |
with: | |
report_individual_runs: true | |
report_suite_logs: 'any' | |
deduplicate_classes_by_file_name: true | |
comment_title: '🛠 Test Results' | |
commit: ${{ github.event.client_payload.pull_request.head.sha }} | |
files: | | |
code/mobile/android/PhoneVR/app/build/outputs/androidTest-results/**/TEST-*.xml | |
- uses: iterative/setup-cml@v1 | |
if: (github.event_name == 'repository_dispatch' || github.event_name == 'pull_request') && always() | |
- name: Publish Screenshots - Find Comment | |
if: github.event_name == 'pull_request' && always() | |
uses: peter-evans/find-comment@v3 | |
id: fc | |
with: | |
issue-number: ${{ github.event.number }} | |
body-includes: '# 📷 Screenshots of tests:' | |
direction: last | |
comment-author: 'github-actions[bot]' | |
- name: Publish Screenshots - Find Comment (Signed) | |
if: | | |
github.event_name == 'repository_dispatch' && | |
github.event.client_payload.slash_command.args.named.sha != '' && | |
contains( | |
github.event.client_payload.pull_request.head.sha, | |
github.event.client_payload.slash_command.args.named.sha | |
) && always() | |
uses: peter-evans/find-comment@v3 | |
id: fcs | |
with: | |
issue-number: ${{ github.event.client_payload.pull_request.number }} | |
body-includes: '# 📷 Screenshots of tests:' | |
direction: last | |
comment-author: 'github-actions[bot]' | |
- name: Publish Screenshots - build comment | |
if: (github.event_name == 'repository_dispatch' || 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: | | |
echo "# 📷 Screenshots of tests:" >> comment.md | |
echo "" >> comment.md | |
# ls -alh | |
# ls -alh app/build/outputs/connected_android_test_additional_output/gvrDebugAndroidTest/connected/ | |
# stat 'app/build/outputs/connected_android_test_additional_output/gvrDebugAndroidTest/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/gvrDebugAndroidTest/connected/*; do | |
ls -alh "$ss_test_avd" | |
echo "$ss_test_avd" | |
ss_test_avd_desc=$(basename "$ss_test_avd") | |
echo "" >> comment.md | |
echo "### 📱gvr: $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/gvrDebugAndroidTest/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" | sed -E 's/.+/<img width="70%" src="\0"\/>/' >> comment.md | |
echo '</p>' >> comment.md | |
done | |
done | |
for ss_test_avd in app/build/outputs/connected_android_test_additional_output/noGvrDebugAndroidTest/connected/*; do | |
ls -alh "$ss_test_avd" | |
echo "$ss_test_avd" | |
ss_test_avd_desc=$(basename "$ss_test_avd") | |
echo "" >> comment.md | |
echo "### 📱noGvr: $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/noGvrDebugAndroidTest/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" | sed -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" == 'repository_dispatch' ] | |
then | |
sha=${{ github.event.client_payload.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@v4 | |
with: | |
comment-id: ${{ steps.fc.outputs.comment-id }} | |
body-file: ${{env.GRADLE_DIR}}/comment.md | |
edit-mode: replace | |
issue-number: ${{ github.event.number }} | |
- name: Publish Screehnshots - Update or Create Comment (Signed) | |
if: | | |
github.event_name == 'repository_dispatch' && | |
github.event.client_payload.slash_command.args.named.sha != '' && | |
contains( | |
github.event.client_payload.pull_request.head.sha, | |
github.event.client_payload.slash_command.args.named.sha | |
) && always() | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
comment-id: ${{ steps.fcs.outputs.comment-id }} | |
body-file: ${{env.GRADLE_DIR}}/comment.md | |
edit-mode: replace | |
issue-number: ${{ github.event.client_payload.pull_request.number }} | |
- name: Update Check Run (Signed) | |
uses: actions/github-script@v7 | |
id: update-check-run | |
if: | | |
github.event_name == 'repository_dispatch' && | |
github.event.client_payload.slash_command.args.named.sha != '' && | |
contains( | |
github.event.client_payload.pull_request.head.sha, | |
github.event.client_payload.slash_command.args.named.sha | |
) && always() | |
env: | |
number: ${{ github.event.client_payload.pull_request.number }} | |
job: "Test APK (30)" | |
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run | |
conclusion: ${{ job.status }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { data: pull } = await github.rest.pulls.get({ | |
...context.repo, | |
pull_number: process.env.number | |
}); | |
const ref = pull.head.sha; | |
const { data: checks } = await github.rest.checks.listForRef({ | |
...context.repo, | |
ref | |
}); | |
console.log(checks); | |
const check = checks.check_runs.filter(c => c.name === process.env.job); | |
console.log(check); | |
console.log("job: " + process.env.job); | |
if( check ) { | |
const { data: result } = await github.rest.checks.update({ | |
...context.repo, | |
check_run_id: check[0].id, | |
status: 'completed', | |
conclusion: process.env.conclusion | |
}); | |
return result; | |
} | |
- name: Save AVD Cache | |
uses: actions/cache/save@v4 | |
if: always() && !steps.avd-cache.outputs.cache-hit && steps.avd_create.outcome == 'success' | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-${{ matrix.api-level }}-${{ env.EMU_TARGET }}-${{ env.EMU_PROFILE }}-${{ env.EMU_AVD_NAME }} # key has to be same as in restore in previous step |