-
Notifications
You must be signed in to change notification settings - Fork 739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to fix integration tests #4842
Changes from all commits
261030f
6a24e02
52c8a13
abf8932
41bf1cc
34efd91
2c8015c
e2616ba
0fb26da
1224144
8adeab0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
pull_request: { } | ||
push: | ||
branches: [ main, develop ] | ||
|
||
# Enrich gradle.properties for CI/CD | ||
env: | ||
CI_GRADLE_ARG_PROPERTIES: > | ||
-Porg.gradle.jvmargs=-Xmx2g | ||
-Porg.gradle.parallel=false | ||
|
||
jobs: | ||
# Build Android Tests [Matrix SDK] | ||
build-android-test-matrix-sdk: | ||
name: Matrix SDK - Build Android Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Build Android Tests for matrix-sdk-android | ||
run: ./gradlew clean matrix-sdk-android:assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false | ||
|
||
# Build Android Tests [Matrix APP] | ||
build-android-test-app: | ||
name: App - Build Android Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Build Android Tests for vector | ||
run: ./gradlew clean vector:assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace -PallWarningsAsErrors=false | ||
|
||
# Run Android Tests | ||
integration-tests: | ||
name: Matrix SDK - Running Integration Tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
api-level: [ 28 ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: gradle/wrapper-validation-action@v1 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: 11 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Cache pip | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
${{ runner.os }}- | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Start synapse server | ||
run: | | ||
python3 -m venv .synapse | ||
source .synapse/bin/activate | ||
pip install synapse matrix-synapse | ||
curl https://raw.githubusercontent.com/matrix-org/synapse/develop/demo/start.sh -o start.sh | ||
chmod 777 start.sh | ||
./start.sh --no-rate-limit | ||
# package: org.matrix.android.sdk.session | ||
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.session] API[${{ matrix.api-level }}] | ||
continue-on-error: true | ||
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 | ||
script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.session' matrix-sdk-android:connectedDebugAndroidTest | ||
- name: Read Results [org.matrix.android.sdk.session] | ||
continue-on-error: true | ||
id: get-comment-body-session | ||
run: | | ||
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" | ||
echo "::set-output name=session::passed=$body" | ||
# package: org.matrix.android.sdk.account | ||
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.account] API[${{ matrix.api-level }}] | ||
continue-on-error: true | ||
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 | ||
script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.account' matrix-sdk-android:connectedDebugAndroidTest | ||
- name: Read Results [org.matrix.android.sdk.account] | ||
continue-on-error: true | ||
id: get-comment-body-account | ||
run: | | ||
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" | ||
echo "::set-output name=account::passed=$body" | ||
# package: org.matrix.android.sdk.internal | ||
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.internal] API[${{ matrix.api-level }}] | ||
continue-on-error: true | ||
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 | ||
script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.internal' matrix-sdk-android:connectedDebugAndroidTest | ||
- name: Read Results [org.matrix.android.sdk.internal] | ||
continue-on-error: true | ||
id: get-comment-body-internal | ||
run: | | ||
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" | ||
echo "::set-output name=internal::passed=$body" | ||
# package: org.matrix.android.sdk.ordering | ||
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.ordering] API[${{ matrix.api-level }}] | ||
continue-on-error: true | ||
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 | ||
script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.ordering' matrix-sdk-android:connectedDebugAndroidTest | ||
- name: Read Results [org.matrix.android.sdk.ordering] | ||
continue-on-error: true | ||
id: get-comment-body-ordering | ||
run: | | ||
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" | ||
echo "::set-output name=ordering::passed=$body" | ||
# package: class PermalinkParserTest | ||
- name: Run integration tests for Matrix SDK class [org.matrix.android.sdk.PermalinkParserTest] API[${{ matrix.api-level }}] | ||
continue-on-error: true | ||
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 | ||
script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class='org.matrix.android.sdk.PermalinkParserTest' matrix-sdk-android:connectedDebugAndroidTest | ||
- name: Read Results [org.matrix.android.sd.PermalinkParserTest] | ||
continue-on-error: true | ||
id: get-comment-body-permalink | ||
run: | | ||
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")" | ||
echo "::set-output name=permalink::passed=$body" | ||
- name: Find Comment | ||
uses: peter-evans/find-comment@v1 | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: Integration Tests Results | ||
- name: Publish results to PR | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
### Matrix SDK | ||
## Integration Tests Results: | ||
- `[org.matrix.android.sdk.session]`<br>${{ steps.get-comment-body-session.outputs.session }} | ||
- `[org.matrix.android.sdk.account]`<br>${{ steps.get-comment-body-account.outputs.account }} | ||
- `[org.matrix.android.sdk.internal]`<br>${{ steps.get-comment-body-internal.outputs.internal }} | ||
- `[org.matrix.android.sdk.ordering]`<br>${{ steps.get-comment-body-ordering.outputs.ordering }} | ||
- `[org.matrix.android.sdk.PermalinkParserTest]`<br>${{ steps.get-comment-body-permalink.outputs.permalink }} | ||
edit-mode: replace | ||
## Useful commands | ||
# script: ./integration_tests_script.sh | ||
# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.session' matrix-sdk-android:connectedDebugAndroidTest --info | ||
# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES matrix-sdk-android:connectedAndroidTest --info | ||
# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -PallWarningsAsErrors=false connectedCheck --stacktrace | ||
# script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.ChunkEntityTest matrix-sdk-android:connectedAndroidTest --info |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix integration tests and add a comment with results (still not perfect due to github actions resource limitations) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ def vanniktechEmoji = "0.8.0" | |
def mockk = "1.12.1" | ||
def espresso = "3.4.0" | ||
def androidxTest = "1.4.0" | ||
def androidxOrchestrator = "1.4.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just update the value of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, I read a bit fast the title at https://developer.android.com/jetpack/androidx/releases/test#core_141_2 Also confirmed that this should not be a problem to use various version by the sample at https://developer.android.com/jetpack/androidx/releases/test#declaring_dependencies |
||
|
||
|
||
ext.libs = [ | ||
|
@@ -63,7 +64,7 @@ ext.libs = [ | |
'pagingRuntimeKtx' : "androidx.paging:paging-runtime-ktx:2.1.2", | ||
'coreTesting' : "androidx.arch.core:core-testing:2.1.0", | ||
'testCore' : "androidx.test:core:$androidxTest", | ||
'orchestrator' : "androidx.test:orchestrator:$androidxTest", | ||
'orchestrator' : "androidx.test:orchestrator:$androidxOrchestrator", | ||
'testRunner' : "androidx.test:runner:$androidxTest", | ||
'testRules' : "androidx.test:rules:$androidxTest", | ||
'espressoCore' : "androidx.test.espresso:espresso-core:$espresso", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
./gradlew -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.ChunkEntityTest matrix-sdk-android:connectedAndroidTest | ||
./gradlew -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.TimelineForwardPaginationTest matrix-sdk-android:connectedAndroidTest |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.ChunkEntityTest matrix-sdk-android:connectedAndroidTest | ||
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class=org.matrix.android.sdk.session.room.timeline.TimelineForwardPaginationTest matrix-sdk-android:connectedAndroidTest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep this action since it is now done when we run the integration test?
It has been added (see the comment here) to ensure that the tests are compiling by making this action "Required" on every PRs.
But now I think we can put the test run "Required".
Thinking more about it, since this action is more reliable than the running of integration test, maybe we can keep it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly thats why I kept it. While its not 100% reliable I think we should keep it