Merge pull request #638 from hannesa2/RenameTests #537
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: Pull request | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
Build: | |
name: Test | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ARM64 ] | |
api: [ 34 ] | |
abi: [ arm64-v8a ] | |
emulatorApi: [ 14 ] | |
tag: [ 'google_apis' ] | |
# include: | |
# - os: macOS-latest | |
# abi: x86_64 | |
# api: 28 | |
# emulatorApi: [ 9 ] | |
# tag: 'default' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- uses: gradle/actions/wrapper-validation@v3 | |
- name: Install Android SDK | |
uses: hannesa2/action-android/[email protected] | |
- name: Android Emulator test | |
uses: hannesa2/action-android/[email protected] | |
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: MQ-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: MQ-Screenshots-${{ matrix.api }}-${{ matrix.abi }}-${{ matrix.emulatorApi }} | |
path: | | |
basicSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | |
basicSample/build/outputs/androidTest-results/connected | |
extendedSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | |
extendedSample/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 extendedSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected | |
set -x | |
cp extendedSample/build/outputs/connected_android_test_additional_output/debugAndroidTest/connected/emulator\(AVD\)\ -\ ${{ matrix.emulatorApi }}/* screenshotsToCompare${{ matrix.emulatorApi }} | |
set +x | |
./screenShotCompare.sh | |
- name: Archive screenshots diffs ${{ matrix.emulatorApi }} | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: MQ-Screenshots-diffs-${{ matrix.emulatorApi }} | |
path: | | |
screenshotDiffs | |
- name: Show git status ${{ matrix.emulatorApi }} | |
if: ${{ always() }} | |
run: | | |
git add screenshotsToCompare${{ matrix.emulatorApi }} | |
git status | |
[ "$(git status -s -uno)" ] && exit 1 || exit 0 | |
Check: | |
name: Check | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: 17 | |
- name: Install Android SDK | |
uses: hannesa2/action-android/[email protected] | |
- name: Run tests | |
run: ./gradlew test | |
- name: Kotlin code checks | |
run: ./gradlew ktlintCheck | |
- name: Code checks | |
run: ./gradlew check | |
- name: Archive Lint report | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: MQTT-Lint-report | |
path: | | |
./**/build/reports/lint-results*.html | |
./**/build/reports/ktlint/ktlintMainSourceSetCheck/ktlintMainSourceSetCheck.txt |