From b1663f1345c7371695cbe7a145f93322a129d2ba Mon Sep 17 00:00:00 2001 From: Alexey Alter-Pesotskiy Date: Wed, 11 Dec 2024 16:51:12 +0000 Subject: [PATCH] Test --- .github/workflows/build-and-test.yml | 5 +++-- .github/workflows/pr-checks.yml | 5 +++-- fastlane/Fastfile | 9 ++++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e2a416825fb..29bb9122419 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -46,8 +46,9 @@ jobs: with: name: testDebugUnitTest path: ./**/build/reports/tests/testDebugUnitTest - - name: Test Coverage - run: ./gradlew sonar + - uses: ./.github/actions/setup-ruby + - name: Sonar + run: bundle exec fastlane run_sonar_analysis env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index a3a847a2744..2026476863f 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -73,8 +73,9 @@ jobs: with: name: testDebugUnitTest path: ./**/build/reports/tests/testDebugUnitTest - - name: Test Coverage - run: ./gradlew sonar + - uses: ./.github/actions/setup-ruby + - name: Sonar + run: bundle exec fastlane run_sonar_analysis env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/fastlane/Fastfile b/fastlane/Fastfile index bc3cad6c907..a62025cba60 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -9,7 +9,7 @@ github_repo = ENV['GITHUB_REPOSITORY'] || 'GetStream/stream-chat-android' test_flavor = 'stream-chat-android-compose-sample' mock_server_driver_port = 4567 is_localhost = !is_ci -@force_check = false +@force_check = true before_all do |lane| if is_ci @@ -34,6 +34,12 @@ lane :stop_mock_server do Net::HTTP.get_response(URI("http://localhost:#{mock_server_driver_port}/stop")) rescue nil end +lane :run_sonar_analysis do |options| + next unless is_check_required(sources: sources_matrix[:unit], force_check: @force_check) + + Dir.chdir('..') { sh('./gradlew sonar') } +end + lane :run_snapshot_test do |options| next unless is_check_required(sources: sources_matrix[:ui], force_check: @force_check) @@ -128,6 +134,7 @@ end private_lane :sources_matrix do { + unit: ['stream-chat-android-client/', 'stream-chat-android-client-test/', 'stream-chat-android-compose/', 'stream-chat-android-core/', 'stream-chat-android-markdown-transformer/', 'stream-chat-android-offline/', 'stream-chat-android-state/', 'stream-chat-android-ui-common/', 'stream-chat-android-ui-components/', 'stream-chat-android-ui-utils/'], ui: ['stream-chat-android-ui', '.github/workflows/snapshot-test'], e2e: ['buildSrc', 'stream-chat-android', '.github/workflows/e2e-test'], ruby: ['fastlane', 'Gemfile', 'Gemfile.lock']