Skip to content

Commit

Permalink
ci: github acceptance improvements [WPB-8666] [WPB-9133] (#3007)
Browse files Browse the repository at this point in the history
  • Loading branch information
Garzas authored May 20, 2024
1 parent d4ec2b5 commit f096658
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

# Specific settings for YAML files
[{*.yml,*.yaml}]
indent_style = space
indent_size = 2

[{*.gradle.kts,*.kt,*.kts,*.main.kts,*.space.kts}]
max_line_length = 140
ij_kotlin_name_count_to_use_star_import = 999
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
cp app/build/outputs/apk/dev/debug/com.wire.*.apk wire-android-${{inputs.flavour}}-pr-${{ github.event.pull_request.number }}.apk
- name: Upload APK
if: success()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: wire-android-${{inputs.flavour}}-pr-${{ github.event.pull_request.number }}.apk
path: ./wire-android-${{inputs.flavour}}-pr-${{ github.event.pull_request.number }}.apk
46 changes: 39 additions & 7 deletions .github/workflows/gradle-run-ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@ name: "Run UI Tests"

on:
merge_group:
push:
branches:
- develop
- release/candidate
- prod
- internal
- main
pull_request:
types: [ opened, synchronize ] # Don't rerun on `edited` to save time
branches:
- develop
- release/candidate
- prod
- internal
- main
workflow_call:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
ui-tests:
runs-on: buildjet-8vcpu-ubuntu-2204
strategy:
matrix:
api-level: [29]
api-level: [ 29 ]

steps:
- name: Checkout
Expand All @@ -32,7 +45,7 @@ jobs:
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@216d1ad2b3710bf005dc39237337b9673fd8fcd5
uses: gradle/actions/wrapper-validation@v3

- name: AVD cache
uses: buildjet/cache@v4
Expand All @@ -49,6 +62,7 @@ jobs:
with:
api-level: ${{ matrix.api-level }}
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
Expand All @@ -61,9 +75,27 @@ jobs:
target: google_apis
script: ./gradlew runAcceptanceTests
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Get commit hash
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Copy test results to simplified directory
run: |
mkdir -p acceptanceTests/flavors
cp -r app/build/reports/androidTests/connected/debug/flavors/* acceptanceTests/flavors/
- name: Zip test results
run: |
zip -r integration-tests-android_${{ env.COMMIT_HASH }}.zip acceptanceTests/flavors/
- name: Upload zipped test results
uses: actions/upload-artifact@v4
with:
name: integration-tests-android_${{ env.COMMIT_HASH }}
path: integration-tests-android_${{ env.COMMIT_HASH }}.zip

- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/gradle-run-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@216d1ad2b3710bf005dc39237337b9673fd8fcd5
uses: gradle/actions/wrapper-validation@v3

- name: Test Build Logic
run: |
Expand All @@ -48,15 +48,26 @@ jobs:
- name: Install Pip for test result publishing
run: sudo apt-get install -y python3-pip

- name: Get commit hash
run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV

- name: Zip test results
run: |
zip -r unit-tests-android_${{ env.COMMIT_HASH }}.zip **/build/test-results/**/*.xml **/build/outputs/androidTest-results/**/*.xml
- name: Upload zipped test results
uses: actions/upload-artifact@v4
with:
name: unit-tests-android_${{ env.COMMIT_HASH }}
path: unit-tests-android_${{ env.COMMIT_HASH }}.zip

# Uploads test results as GitHub artifacts, so publish-test-results can find them later.
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
# This name is referenced in the publish-test-results workflow.
name: test-results
path: |
**/build/test-results/testDevDebugUnitTest/**/*.xml
**/build/test-results/**/*.xml
**/build/outputs/androidTest-results/**/*.xml
Expand Down Expand Up @@ -107,7 +118,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import io.mockk.coVerify
import io.mockk.every
import io.mockk.impl.annotations.MockK
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.advanceUntilIdle
import kotlinx.coroutines.test.runTest
import org.amshove.kluent.internal.assertEquals
import org.junit.jupiter.api.Test
Expand Down Expand Up @@ -87,6 +88,7 @@ class CallActivityViewModelTest {
.arrange()

viewModel.switchAccountIfNeeded(userId)
advanceUntilIdle()

coVerify(exactly = 1) { arrangement.accountSwitch(any()) }
}
Expand All @@ -100,6 +102,7 @@ class CallActivityViewModelTest {
.arrange()

viewModel.switchAccountIfNeeded(UserId("anotherUserId", "domain"))
advanceUntilIdle()

coVerify(exactly = 1) { arrangement.accountSwitch(any()) }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,14 +863,14 @@ class WireActivityViewModelTest {
val ongoingCall = Call(
CommonTopAppBarViewModelTest.conversationId,
CallStatus.ESTABLISHED,
true,
false,
false,
"caller-id",
"ONE_ON_ONE Name",
Conversation.Type.ONE_ON_ONE,
"otherUsername",
"team1"
isMuted = true,
isCameraOn = false,
isCbrEnabled = false,
callerId = "caller-id",
conversationName = "ONE_ON_ONE Name",
conversationType = Conversation.Type.ONE_ON_ONE,
callerName = "otherUsername",
callerTeamName = "team1"
)
}
}

0 comments on commit f096658

Please sign in to comment.