Espresso test with screenshot compare #322
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: Renderer | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
env: | |
resourceRunID: ${{ github.run_id }}-${{ github.run_number }} | |
jobs: | |
androidBuild: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
api: [ 34 ] | |
abi: [ x86_64 ] | |
emulatorApi: [ 14 ] | |
tag: [ 'google_apis' ] | |
# include: | |
# - os: macOS-latest | |
# abi: x86_64 | |
# api: 28 | |
# emulatorApi: [ 9 ] | |
# tag: 'default' | |
steps: | |
- name: kvm support | |
run: | | |
egrep -c '(vmx|svm)' /proc/cpuinfo | |
id | |
sudo adduser $USER kvm | |
sudo chown -R $USER /dev/kvm | |
id | |
- name: prepare | |
run: | | |
sudo apt-get update && sudo apt-get install -y exiftool imagemagick xdg-utils libimage-exiftool-perl zsh jq xorg | |
# brew install exiftool imagemagick | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- name: assemble ViroCore | |
run: | | |
./gradlew :viroreact:assembleDebug | |
./gradlew :code-samples:ARPlacingObjects:assembleDebug | |
./gradlew :code-samples:ARRetail:assembleDebug | |
./gradlew :code-samples:ARTesla:assembleDebug | |
./gradlew :code-samples:ARHelloWorldAndroid:assembleDebug | |
./gradlew :code-samples:ARBlackPanther:assembleDebug | |
./gradlew :mainSample:assembleDebug | |
working-directory: ./android | |
- name: Upload result ViroCore | |
uses: actions/upload-artifact@v4.4.0 | |
with: | |
name: viroCore | |
path: | | |
./android/virocore/build/outputs/aar/*.aar | |
./android/viroreact/build/outputs/aar/*.aar | |
./android/viroar/build/outputs/aar/*.aar | |
- name: Install Android SDK | |
uses: hannesa2/action-android/install-sdk@0.1.16.7 | |
- name: Android Emulator test | |
uses: hannesa2/action-android/emulator-run-cmd@0.1.16.7 | |
with: | |
cmd: ./gradlew cAT --continue | |
api: ${{ matrix.api }} | |
tag: ${{ matrix.tag }} | |
abi: ${{ matrix.abi }} | |
cmdOptions: -noaudio -no-boot-anim -no-window -metrics-collection | |
bootTimeout: 720 | |
- uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: Viro-Espresso-${{ matrix.api }}-${{ matrix.abi }}-report-${{ matrix.emulatorApi }} | |
path: | | |
./**/build/reports/androidTests/connected | |
./**/build/outputs/androidTest-results/connected | |
- name: Archive screenshots ${{ matrix.emulatorApi }} | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: Viro-Screenshots-${{ matrix.api }}-${{ matrix.abi }}-${{ matrix.emulatorApi }} | |
path: | | |
basicSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | |
basicSample/build/outputs/androidTest-results/connected | |
mainSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | |
mainSample/build/outputs/androidTest-results/connected | |
serviceLibrary/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | |
serviceLibrary/build/outputs/androidTest-results/connected | |
- name: Compare screenshots | |
if: ${{ always() }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
emulatorApi: ${{ matrix.emulatorApi }} | |
run: | | |
ls -ls mainSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | |
cp mainSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/emulator-5554\ -\ ${{ matrix.emulatorApi }}/* screenshotsToCompare${{ matrix.emulatorApi }} | |
export DISPLAY=:99 | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
echo ${{ env.resourceRunID }} | |
./screenShotCompare.sh ${{ env.resourceRunID }} | |
- name: Archive screenshots diffs ${{ matrix.emulatorApi }} | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Viro-Screenshots-diffs-${{ matrix.emulatorApi }} | |
path: | | |
screenshotDiffs | |
screenshotsToCompare${{ matrix.emulatorApi }}/view-*.png | |
- name: Show git status ${{ matrix.emulatorApi }} | |
if: ${{ always() }} | |
run: | | |
git add screenshotsToCompare${{ matrix.emulatorApi }} | |
git status | |
[ "$(git status -s -uno)" ] && exit 1 || exit 0 | |
AndroidCheck: | |
name: Check | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: android | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4.2.0 | |
with: | |
fetch-depth: 0 | |
- name: Install JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "adopt" | |
java-version: 17 | |
- uses: gradle/wrapper-validation-action@v3 | |
- name: Code checks | |
run: ./gradlew :viroreact:check | |
- name: Archive Lint report | |
uses: actions/upload-artifact@v4.4.0 | |
if: ${{ always() }} | |
with: | |
name: Viro-Lint-report | |
path: | | |
./**/build/reports/lint-results.html | |
./**/**/build/reports/lint-results.html | |
iosBuild: | |
runs-on: ${{ matrix.macOS }} | |
strategy: | |
fail-fast: false | |
matrix: | |
macOS: [ "macos-13" ] | |
xcode: [ "15.2.0" ] | |
steps: | |
- name: Investigate available XCode versions | |
run: ls -n /Applications/ | grep Xcode* | |
- uses: actions/checkout@v4.2.0 | |
- name: Install gpg | |
run: brew install gnupg | |
- uses: maxim-lobanov/setup-xcode@v1.6.0 | |
with: | |
xcode-version: ${{ matrix.xcode }} | |
- name: Install pod dependencies | |
run: | | |
cd ios | |
pod install --verbose | |
shell: bash | |
- name: Xcodebuild iOS Renderer (non-static) | |
run: | | |
cd ios | |
set -o pipefail && xcodebuild \ | |
-workspace ViroRenderer.xcworkspace \ | |
-scheme ViroKit \ | |
-sdk iphoneos \ | |
-configuration Release \ | |
IPHONEOS_DEPLOYMENT_TARGET=13.0 | xcpretty | |
- name: Upload iOS Renderer artifact | |
uses: actions/upload-artifact@v4.4.0 | |
with: | |
name: ios_dist.tgz | |
path: ./ios/dist/ |