|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: { } |
| 5 | + push: |
| 6 | + branches: [ main, develop ] |
| 7 | + |
| 8 | +# Enrich gradle.properties for CI/CD |
| 9 | +env: |
| 10 | + CI_GRADLE_ARG_PROPERTIES: > |
| 11 | + -Porg.gradle.jvmargs=-Xmx2g |
| 12 | + -Porg.gradle.parallel=false |
| 13 | +
|
| 14 | +jobs: |
| 15 | + # Build Android Tests [Matrix SDK] |
| 16 | + build-android-test-matrix-sdk: |
| 17 | + name: Matrix SDK - Build Android Tests |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + - uses: actions/cache@v2 |
| 22 | + with: |
| 23 | + path: | |
| 24 | + ~/.gradle/caches |
| 25 | + ~/.gradle/wrapper |
| 26 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 27 | + restore-keys: | |
| 28 | + ${{ runner.os }}-gradle- |
| 29 | + - name: Build Android Tests for matrix-sdk-android |
| 30 | + run: ./gradlew clean matrix-sdk-android:assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false |
| 31 | + |
| 32 | + # Build Android Tests [Matrix APP] |
| 33 | + build-android-test-app: |
| 34 | + name: App - Build Android Tests |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v2 |
| 38 | + - uses: actions/cache@v2 |
| 39 | + with: |
| 40 | + path: | |
| 41 | + ~/.gradle/caches |
| 42 | + ~/.gradle/wrapper |
| 43 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-gradle- |
| 46 | + - name: Build Android Tests for vector |
| 47 | + run: ./gradlew clean vector:assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false |
| 48 | + |
| 49 | + # Run Android Tests |
| 50 | + integration-tests: |
| 51 | + name: Matrix SDK - Running Integration Tests |
| 52 | + runs-on: ubuntu-latest |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: |
| 56 | + api-level: [ 28 ] |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v2 |
| 59 | + - uses: gradle/wrapper-validation-action@v1 |
| 60 | + - uses: actions/setup-java@v2 |
| 61 | + with: |
| 62 | + distribution: 'adopt' |
| 63 | + java-version: 11 |
| 64 | + - name: Set up Python 3.8 |
| 65 | + uses: actions/setup-python@v2 |
| 66 | + with: |
| 67 | + python-version: 3.8 |
| 68 | + - name: Cache pip |
| 69 | + uses: actions/cache@v2 |
| 70 | + with: |
| 71 | + path: ~/.cache/pip |
| 72 | + key: ${{ runner.os }}-pip |
| 73 | + restore-keys: | |
| 74 | + ${{ runner.os }}-pip- |
| 75 | + ${{ runner.os }}- |
| 76 | + - uses: actions/cache@v2 |
| 77 | + with: |
| 78 | + path: | |
| 79 | + ~/.gradle/caches |
| 80 | + ~/.gradle/wrapper |
| 81 | + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 82 | + restore-keys: | |
| 83 | + ${{ runner.os }}-gradle- |
| 84 | + - name: Start synapse server |
| 85 | + run: | |
| 86 | + python3 -m venv .synapse |
| 87 | + source .synapse/bin/activate |
| 88 | + pip install synapse matrix-synapse |
| 89 | + curl https://raw.githubusercontent.com/matrix-org/synapse/develop/demo/start.sh -o start.sh |
| 90 | + chmod 777 start.sh |
| 91 | + ./start.sh --no-rate-limit |
| 92 | +# package: org.matrix.android.sdk.session |
| 93 | + - name: Run integration tests for Matrix SDK [org.matrix.android.sdk.session] API[${{ matrix.api-level }}] |
| 94 | + continue-on-error: true |
| 95 | + uses: reactivecircus/android-emulator-runner@v2 |
| 96 | + with: |
| 97 | + api-level: ${{ matrix.api-level }} |
| 98 | + arch: x86 |
| 99 | + profile: Nexus 5X |
| 100 | + force-avd-creation: false |
| 101 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 102 | + emulator-build: 7425822 |
| 103 | + script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.session' matrix-sdk-android:connectedDebugAndroidTest |
| 104 | + - name: Read Results [org.matrix.android.sdk.session] |
| 105 | + continue-on-error: true |
| 106 | + id: get-comment-body-session |
| 107 | + run: | |
| 108 | + body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" |
| 109 | + echo "::set-output name=session::passed=$body" |
| 110 | +# package: org.matrix.android.sdk.account |
| 111 | + - name: Run integration tests for Matrix SDK [org.matrix.android.sdk.account] API[${{ matrix.api-level }}] |
| 112 | + continue-on-error: true |
| 113 | + uses: reactivecircus/android-emulator-runner@v2 |
| 114 | + with: |
| 115 | + api-level: ${{ matrix.api-level }} |
| 116 | + arch: x86 |
| 117 | + profile: Nexus 5X |
| 118 | + force-avd-creation: false |
| 119 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 120 | + emulator-build: 7425822 |
| 121 | + script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.account' matrix-sdk-android:connectedDebugAndroidTest |
| 122 | + - name: Read Results [org.matrix.android.sdk.account] |
| 123 | + continue-on-error: true |
| 124 | + id: get-comment-body-account |
| 125 | + run: | |
| 126 | + body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" |
| 127 | + echo "::set-output name=account::passed=$body" |
| 128 | +# package: org.matrix.android.sdk.internal |
| 129 | + - name: Run integration tests for Matrix SDK [org.matrix.android.sdk.internal] API[${{ matrix.api-level }}] |
| 130 | + continue-on-error: true |
| 131 | + uses: reactivecircus/android-emulator-runner@v2 |
| 132 | + with: |
| 133 | + api-level: ${{ matrix.api-level }} |
| 134 | + arch: x86 |
| 135 | + profile: Nexus 5X |
| 136 | + force-avd-creation: false |
| 137 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 138 | + emulator-build: 7425822 |
| 139 | + script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.internal' matrix-sdk-android:connectedDebugAndroidTest |
| 140 | + - name: Read Results [org.matrix.android.sdk.internal] |
| 141 | + continue-on-error: true |
| 142 | + id: get-comment-body-internal |
| 143 | + run: | |
| 144 | + body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" |
| 145 | + echo "::set-output name=internal::passed=$body" |
| 146 | +# package: org.matrix.android.sdk.ordering |
| 147 | + - name: Run integration tests for Matrix SDK [org.matrix.android.sdk.ordering] API[${{ matrix.api-level }}] |
| 148 | + continue-on-error: true |
| 149 | + uses: reactivecircus/android-emulator-runner@v2 |
| 150 | + with: |
| 151 | + api-level: ${{ matrix.api-level }} |
| 152 | + arch: x86 |
| 153 | + profile: Nexus 5X |
| 154 | + force-avd-creation: false |
| 155 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 156 | + emulator-build: 7425822 |
| 157 | + script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.ordering' matrix-sdk-android:connectedDebugAndroidTest |
| 158 | + - name: Read Results [org.matrix.android.sdk.ordering] |
| 159 | + continue-on-error: true |
| 160 | + id: get-comment-body-ordering |
| 161 | + run: | |
| 162 | + body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" |
| 163 | + echo "::set-output name=ordering::passed=$body" |
| 164 | +# package: class PermalinkParserTest |
| 165 | + - name: Run integration tests for Matrix SDK class [org.matrix.android.sdk.PermalinkParserTest] API[${{ matrix.api-level }}] |
| 166 | + continue-on-error: true |
| 167 | + uses: reactivecircus/android-emulator-runner@v2 |
| 168 | + with: |
| 169 | + api-level: ${{ matrix.api-level }} |
| 170 | + arch: x86 |
| 171 | + profile: Nexus 5X |
| 172 | + force-avd-creation: false |
| 173 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 174 | + emulator-build: 7425822 |
| 175 | + script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class='org.matrix.android.sdk.PermalinkParserTest' matrix-sdk-android:connectedDebugAndroidTest |
| 176 | + - name: Read Results [org.matrix.android.sd.PermalinkParserTest] |
| 177 | + continue-on-error: true |
| 178 | + id: get-comment-body-permalink |
| 179 | + run: | |
| 180 | + body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" |
| 181 | + echo "::set-output name=permalink::passed=$body" |
| 182 | + - name: Find Comment |
| 183 | + uses: peter-evans/find-comment@v1 |
| 184 | + id: fc |
| 185 | + with: |
| 186 | + issue-number: ${{ github.event.pull_request.number }} |
| 187 | + comment-author: 'github-actions[bot]' |
| 188 | + body-includes: Integration Tests Results |
| 189 | + - name: Publish results to PR |
| 190 | + uses: peter-evans/create-or-update-comment@v1 |
| 191 | + with: |
| 192 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
| 193 | + issue-number: ${{ github.event.pull_request.number }} |
| 194 | + body: | |
| 195 | + ### Matrix SDK |
| 196 | + ## Integration Tests Results: |
| 197 | + - `[org.matrix.android.sdk.session]`<br>${{ steps.get-comment-body-session.outputs.session }} |
| 198 | + - `[org.matrix.android.sdk.account]`<br>${{ steps.get-comment-body-account.outputs.account }} |
| 199 | + - `[org.matrix.android.sdk.internal]`<br>${{ steps.get-comment-body-internal.outputs.internal }} |
| 200 | + - `[org.matrix.android.sdk.ordering]`<br>${{ steps.get-comment-body-ordering.outputs.ordering }} |
| 201 | + - `[org.matrix.android.sdk.PermalinkParserTest]`<br>${{ steps.get-comment-body-permalink.outputs.permalink }} |
| 202 | + edit-mode: replace |
| 203 | +## Useful commands |
| 204 | +# script: ./integration_tests_script.sh |
| 205 | +# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.session' matrix-sdk-android:connectedDebugAndroidTest --info |
| 206 | +# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES matrix-sdk-android:connectedAndroidTest --info |
| 207 | +# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedCheck --stacktrace |
| 208 | +# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.ChunkEntityTest matrix-sdk-android:connectedAndroidTest --info |
0 commit comments