2022-05-09 21:49:34 +08:00
|
|
|
name: Integration Tests
|
|
|
|
|
|
|
|
# This runs for all closed pull requests against main, including those closed without merge.
|
|
|
|
# Further filtering occurs in 'should-i-run'
|
2022-01-04 07:04:41 +08:00
|
|
|
|
|
|
|
on:
|
2022-05-09 22:12:29 +08:00
|
|
|
pull_request:
|
2022-05-09 21:49:34 +08:00
|
|
|
types: [closed]
|
|
|
|
branches: [develop]
|
2022-01-04 07:04:41 +08:00
|
|
|
|
|
|
|
# Enrich gradle.properties for CI/CD
|
|
|
|
env:
|
2022-08-04 17:00:47 +08:00
|
|
|
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
2022-08-03 22:53:27 +08:00
|
|
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 2 --no-daemon
|
2022-05-09 21:49:34 +08:00
|
|
|
|
2022-01-04 07:04:41 +08:00
|
|
|
jobs:
|
2022-05-09 21:49:34 +08:00
|
|
|
|
|
|
|
# More info on should-i-run:
|
2022-11-24 16:46:11 +08:00
|
|
|
# If this fails to run (the IF doesn't complete) then the needs will not be satisfied for any of the
|
2022-05-09 21:49:34 +08:00
|
|
|
# other jobs below, so none will run.
|
|
|
|
# except for the notification job at the bottom which will run all the time, unless should-i-run isn't
|
|
|
|
# successful, or all the other jobs have succeeded
|
|
|
|
|
|
|
|
should-i-run:
|
|
|
|
name: Check if PR is suitable for analysis
|
|
|
|
runs-on: ubuntu-latest
|
2022-05-09 22:46:07 +08:00
|
|
|
if: github.event.pull_request.merged # Additionally require PR to have been completely merged.
|
2022-05-09 21:49:34 +08:00
|
|
|
steps:
|
|
|
|
- run: echo "Run those tests!" # no-op success
|
2022-11-24 16:46:11 +08:00
|
|
|
|
2022-02-25 22:18:56 +08:00
|
|
|
ui-tests:
|
|
|
|
name: UI Tests (Synapse)
|
2022-05-09 21:49:34 +08:00
|
|
|
needs: should-i-run
|
2022-09-19 20:31:35 +08:00
|
|
|
runs-on: buildjet-4vcpu-ubuntu-2204
|
2022-11-24 16:46:11 +08:00
|
|
|
timeout-minutes: 90 # We might need to increase it if the time for tests grows
|
2022-02-25 22:18:56 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
api-level: [ 28 ]
|
2022-02-28 20:29:52 +08:00
|
|
|
# No concurrency required, runs every time on a schedule.
|
2022-02-25 22:18:56 +08:00
|
|
|
steps:
|
2022-03-08 07:05:24 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-02-25 22:18:56 +08:00
|
|
|
- name: Set up Python 3.8
|
2022-06-14 07:05:19 +08:00
|
|
|
uses: actions/setup-python@v4
|
2022-02-25 22:18:56 +08:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
2023-01-19 19:20:16 +08:00
|
|
|
- uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
distribution: 'adopt'
|
|
|
|
java-version: '11'
|
|
|
|
- name: Configure gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
2022-02-25 22:18:56 +08:00
|
|
|
with:
|
2023-01-19 19:20:16 +08:00
|
|
|
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
2022-02-25 22:18:56 +08:00
|
|
|
- name: Start synapse server
|
2022-10-18 07:04:02 +08:00
|
|
|
uses: michaelkaye/setup-matrix-synapse@v1.0.4
|
2022-03-10 02:26:37 +08:00
|
|
|
with:
|
|
|
|
uploadLogs: true
|
|
|
|
httpPort: 8080
|
|
|
|
disableRateLimiting: true
|
2022-05-05 21:35:54 +08:00
|
|
|
public_baseurl: "http://10.0.2.2:8080/"
|
2022-02-25 22:18:56 +08:00
|
|
|
- name: Run sanity tests on API ${{ matrix.api-level }}
|
|
|
|
uses: reactivecircus/android-emulator-runner@v2
|
|
|
|
with:
|
|
|
|
api-level: ${{ matrix.api-level }}
|
|
|
|
arch: x86
|
|
|
|
profile: Nexus 5X
|
|
|
|
force-avd-creation: false
|
|
|
|
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
|
|
emulator-build: 7425822 # workaround to emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160
|
|
|
|
script: |
|
|
|
|
adb root
|
|
|
|
adb logcat -c
|
|
|
|
touch emulator.log
|
|
|
|
chmod 777 emulator.log
|
|
|
|
adb logcat >> emulator.log &
|
2022-03-08 21:26:04 +08:00
|
|
|
./gradlew $CI_GRADLE_ARG_PROPERTIES connectedGplayDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=im.vector.app.ui.UiAllScreensSanityTest || (adb pull storage/emulated/0/Pictures/failure_screenshots && exit 1 )
|
2022-02-25 22:18:56 +08:00
|
|
|
- name: Upload Test Report Log
|
2022-04-12 07:08:54 +08:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-02-25 22:18:56 +08:00
|
|
|
if: always()
|
|
|
|
with:
|
2022-03-01 01:06:34 +08:00
|
|
|
name: uitest-error-results
|
2022-02-25 22:18:56 +08:00
|
|
|
path: |
|
|
|
|
emulator.log
|
|
|
|
failure_screenshots/
|
|
|
|
|
2022-05-09 21:49:34 +08:00
|
|
|
# Notify the channel about delayed failures
|
2022-02-25 22:18:56 +08:00
|
|
|
notify:
|
2022-03-09 18:21:29 +08:00
|
|
|
name: Notify matrix
|
2022-02-25 22:18:56 +08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
2022-05-09 21:49:34 +08:00
|
|
|
- should-i-run
|
2022-02-28 20:29:52 +08:00
|
|
|
- ui-tests
|
2022-10-18 16:00:18 +08:00
|
|
|
if: always() && (needs.should-i-run.result == 'success' ) && (needs.ui-tests.result != 'success')
|
2022-02-28 20:29:52 +08:00
|
|
|
# No concurrency required, runs every time on a schedule.
|
2022-02-25 22:18:56 +08:00
|
|
|
steps:
|
2022-03-30 23:46:44 +08:00
|
|
|
- uses: michaelkaye/matrix-hookshot-action@v1.0.0
|
2022-02-28 20:29:52 +08:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-30 23:46:44 +08:00
|
|
|
hookshot_url: ${{ secrets.ELEMENT_ANDROID_HOOKSHOT_URL }}
|
2022-05-18 00:40:42 +08:00
|
|
|
text_template: "Post-merge validation of ${{ github.head_ref }} into ${{ github.base_ref }} by ${{ github.event.pull_request.merged_by.login }} failed: {{#each job_statuses }}{{#with this }}{{#if completed }} {{name}} {{conclusion}} at {{completed_at}}, {{/if}}{{/with}}{{/each}}"
|
|
|
|
html_template: "Post-merge validation of ${{ github.head_ref }} into ${{ github.base_ref }} by ${{ github.event.pull_request.merged_by.login }} failed: {{#each job_statuses }}{{#with this }}{{#if completed }}<br />{{icon conclusion}} {{name}} <font color='{{color conclusion}}'>{{conclusion}} at {{completed_at}} <a href=\"{{html_url}}\">[details]</a></font>{{/if}}{{/with}}{{/each}}"
|