diff --git a/.github/actions/enable-kvm/action.yml b/.github/actions/enable-kvm/action.yml new file mode 100644 index 0000000000..068f309e97 --- /dev/null +++ b/.github/actions/enable-kvm/action.yml @@ -0,0 +1,11 @@ +name: 'Enable KVM' +description: 'Enables hardware accelerated Android virtualization on Actions Linux larger hosted runners' +runs: + using: "composite" + steps: + - name: Enable KVM group perms + shell: bash + run: | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm diff --git a/.github/actions/gradle-cache/action.yml b/.github/actions/gradle-cache/action.yml new file mode 100644 index 0000000000..9f4a14819c --- /dev/null +++ b/.github/actions/gradle-cache/action.yml @@ -0,0 +1,13 @@ +name: 'Gradle Cache' +description: 'Cache Gradle Build Cache to improve workflow execution time' +runs: + using: "composite" + steps: + - uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- diff --git a/.github/actions/setup-java/action.yml b/.github/actions/setup-java/action.yml new file mode 100644 index 0000000000..7874bd350d --- /dev/null +++ b/.github/actions/setup-java/action.yml @@ -0,0 +1,10 @@ +name: 'Setup Java' +description: 'Setup Java' +runs: + using: "composite" + steps: + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: adopt + java-version: 17 diff --git a/.github/actions/setup-ruby/action.yml b/.github/actions/setup-ruby/action.yml new file mode 100644 index 0000000000..8a56bec008 --- /dev/null +++ b/.github/actions/setup-ruby/action.yml @@ -0,0 +1,9 @@ +name: 'Setup Ruby' +description: 'Setup Ruby and cache bundler' +runs: + using: "composite" + steps: + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.1 + bundler-cache: true diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index aa7e5293fa..dee924f674 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -3,15 +3,24 @@ name: Android CI on: push: branches: [ main ] + pull_request: branches: - '**' + workflow_dispatch: + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + env: BUILD_CACHE_AWS_REGION: ${{ secrets.BUILD_CACHE_AWS_REGION }} BUILD_CACHE_AWS_BUCKET: ${{ secrets.BUILD_CACHE_AWS_BUCKET }} BUILD_CACHE_AWS_ACCESS_KEY_ID: ${{ secrets.BUILD_CACHE_AWS_ACCESS_KEY_ID }} BUILD_CACHE_AWS_SECRET_KEY: ${{ secrets.BUILD_CACHE_AWS_SECRET_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_PR_NUM: ${{ github.event.pull_request.number }} jobs: lint: @@ -20,11 +29,7 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3.1.0 - - name: Set up JDK - uses: actions/setup-java@v3.6.0 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: spotless run: ./gradlew spotlessCheck --scan @@ -34,11 +39,7 @@ jobs: steps: - name: Check out code uses: actions/checkout@v3.1.0 - - name: Set up JDK - uses: actions/setup-java@v3.6.0 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: API check run: ./gradlew apiCheck --scan @@ -47,21 +48,9 @@ jobs: steps: - uses: actions/checkout@v3 - - name: set up JDK - uses: actions/setup-java@v3.6.0 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - - name: Cache Gradle and wrapper - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- + - uses: ./.github/actions/gradle-cache - name: Make Gradle executable run: chmod +x ./gradlew @@ -79,26 +68,14 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: set up JDK - uses: actions/setup-java@v3.6.0 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - - name: Cache Gradle and wrapper - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- + - uses: ./.github/actions/gradle-cache - name: Run unit tests run: | - ./gradlew :stream-video-android-ui-compose:testDebugUnitTest --scan --stacktrace - ./gradlew :stream-video-android-core:testDebugUnitTest --scan --stacktrace + ./gradlew :stream-video-android-ui-compose:koverXmlReport --scan --stacktrace + ./gradlew :stream-video-android-core:koverXmlReport --scan --stacktrace - name: Unit tests core results uses: actions/upload-artifact@v4 @@ -112,21 +89,26 @@ jobs: name: unit-tests-compose-results path: stream-video-android-ui-compose/build/reports/tests/testDebugUnitTest/index.html + - uses: ./.github/actions/setup-ruby + + - name: Sonar + run: bundle exec fastlane run_sonar_analysis + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + androidTest-GMD: name: Android Test with GMD if: ${{ false }} # disable for now - runs-on: macOS-latest + runs-on: ubuntu-latest timeout-minutes: 55 steps: - name: Checkout uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3.6.0 - with: - distribution: 'zulu' - java-version: 17 + - uses: ./.github/actions/setup-java + + - uses: ./.github/actions/enable-kvm # Sets gradle up - name: Setup Gradle diff --git a/.github/workflows/app-distribute.yml b/.github/workflows/app-distribute.yml index ccc307da8b..f49814d962 100644 --- a/.github/workflows/app-distribute.yml +++ b/.github/workflows/app-distribute.yml @@ -12,11 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: Prepare environment run: | echo "${{ secrets.RELEASE_KEYSTORE }}" > .sign/release.keystore.asc diff --git a/.github/workflows/artifact-upload.yaml b/.github/workflows/artifact-upload.yaml index 70a0e54121..d6b6fcc0de 100644 --- a/.github/workflows/artifact-upload.yaml +++ b/.github/workflows/artifact-upload.yaml @@ -15,11 +15,7 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: Prepare environment run: | diff --git a/.github/workflows/internal-app-distribute.yml b/.github/workflows/internal-app-distribute.yml index f25c4350ee..d9a1bcafe2 100644 --- a/.github/workflows/internal-app-distribute.yml +++ b/.github/workflows/internal-app-distribute.yml @@ -12,11 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: Prepare environment run: | echo "${{ secrets.RELEASE_KEYSTORE }}" > .sign/release.keystore.asc diff --git a/.github/workflows/publish-snapshot.yml b/.github/workflows/publish-snapshot.yml index 53be921e2a..c81e2caf40 100644 --- a/.github/workflows/publish-snapshot.yml +++ b/.github/workflows/publish-snapshot.yml @@ -5,7 +5,7 @@ on: branches: - develop workflow_dispatch: - + jobs: publish: name: Snapshot build and publish @@ -14,11 +14,7 @@ jobs: - name: Check out code uses: actions/checkout@v3.1.0 - - name: Set up JDK 17 - uses: actions/setup-java@v3.6.0 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: Release build # assembleRelease for all modules, excluding non-library modules: samples, docs diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 109b7a1731..baea6c2d82 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -16,11 +16,7 @@ jobs: # with: # ref: release - - name: Set up JDK 17 - uses: actions/setup-java@v3.6.0 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: Release build # assembleRelease for all modules, excluding non-library modules: samples, docs diff --git a/.github/workflows/release-docs.yaml b/.github/workflows/release-docs.yaml index ab283654c0..5cd734c312 100644 --- a/.github/workflows/release-docs.yaml +++ b/.github/workflows/release-docs.yaml @@ -15,11 +15,7 @@ jobs: uses: actions/checkout@v3.1.0 with: ref: main - - name: Set up JDK 17 - uses: actions/setup-java@v3.6.0 - with: - distribution: adopt - java-version: 17 + - uses: ./.github/actions/setup-java - name: Generate Dokka HTML docs run: ./gradlew dokkaHtmlMultimodule - name: Deploy to GitHub pages diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..c412a54577 --- /dev/null +++ b/Gemfile @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } + +gem 'fastlane', '2.225.0' +gem 'json' +gem 'rubocop', '1.38', group: :rubocop_dependencies +gem 'sinatra', group: :sinatra_dependencies + +eval_gemfile('fastlane/Pluginfile') + +group :rubocop_dependencies do + gem 'rubocop-performance' + gem 'rubocop-require_tools' +end + +group :sinatra_dependencies do + gem 'eventmachine' + gem 'faye-websocket' + gem 'puma' + gem 'rackup' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..b9092ab280 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,291 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.7) + base64 + nkf + rexml + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + artifactory (3.0.17) + ast (2.4.2) + atomos (0.1.3) + aws-eventstream (1.3.0) + aws-partitions (1.1004.0) + aws-sdk-core (3.212.0) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.992.0) + aws-sigv4 (~> 1.9) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.95.0) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.170.1) + aws-sdk-core (~> 3, >= 3.210.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.10.1) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + base64 (0.2.0) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.6.5) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.6.20240107) + dotenv (2.8.1) + emoji_regex (3.2.3) + eventmachine (1.2.7) + excon (0.112.0) + faraday (1.10.4) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.2) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.1) + faraday (~> 1.0) + fastimage (2.3.1) + fastlane (2.225.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored (~> 1.2) + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + fastlane-sirp (>= 1.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + http-cookie (~> 1.0.5) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (>= 2.0.0, < 3.0.0) + naturally (~> 2.2) + optparse (>= 0.1.1, < 1.0.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.5) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (~> 3) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + fastlane-plugin-stream_actions (0.3.74) + xctest_list (= 1.2.1) + fastlane-sirp (1.0.0) + sysrandom (~> 1.0) + faye-websocket (0.11.3) + eventmachine (>= 0.12.0) + websocket-driver (>= 0.5.1) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.3) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.31.0) + google-apis-core (>= 0.11.0, < 2.a) + google-cloud-core (1.7.1) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.4.0) + google-cloud-storage (1.47.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.31.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.7) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.6.2) + json (2.8.1) + jwt (2.9.3) + base64 + logger (1.6.1) + mini_magick (4.13.2) + mini_mime (1.1.5) + multi_json (1.15.0) + multipart-post (2.4.1) + mustermann (3.0.3) + ruby2_keywords (~> 0.0.1) + nanaimo (0.4.0) + naturally (2.2.1) + nio4r (2.7.4) + nkf (0.2.0) + optparse (0.6.0) + os (1.1.4) + parallel (1.26.3) + parser (3.3.6.0) + ast (~> 2.4.1) + racc + plist (3.7.1) + public_suffix (6.0.1) + puma (6.4.3) + nio4r (~> 2.0) + racc (1.8.1) + rack (3.1.8) + rack-protection (4.1.0) + base64 (>= 0.1.0) + logger (>= 1.6.0) + rack (>= 3.0.0, < 4) + rack-session (2.0.0) + rack (>= 3.0.0) + rackup (2.2.0) + rack (>= 3) + rainbow (3.1.1) + rake (13.2.1) + regexp_parser (2.9.2) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.3.9) + rouge (2.0.7) + rubocop (1.38.0) + json (~> 2.3) + parallel (~> 1.10) + parser (>= 3.1.2.1) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.23.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.35.0) + parser (>= 3.3.1.0) + rubocop-performance (1.19.1) + rubocop (>= 1.7.0, < 2.0) + rubocop-ast (>= 0.4.0) + rubocop-require_tools (0.1.2) + rubocop (>= 0.49.1) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.5) + signet (0.19.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.10) + CFPropertyList + naturally + sinatra (4.1.0) + logger (>= 1.6.0) + mustermann (~> 3.0) + rack (>= 3.0.0, < 4) + rack-protection (= 4.1.0) + rack-session (>= 2.0.0, < 3) + tilt (~> 2.0) + sysrandom (1.0.5) + terminal-notifier (2.0.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + tilt (2.4.0) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.2) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unicode-display_width (2.6.0) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + word_wrap (1.0.0) + xcodeproj (1.27.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.4.0) + rexml (>= 3.3.6, < 4.0) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + xctest_list (1.2.1) + +PLATFORMS + arm64-darwin-21 + ruby + +DEPENDENCIES + eventmachine + fastlane (= 2.225.0) + fastlane-plugin-stream_actions (= 0.3.74) + faye-websocket + json + puma + rackup + rubocop (= 1.38) + rubocop-performance + rubocop-require_tools + sinatra + +BUNDLED WITH + 2.5.17 diff --git a/build.gradle.kts b/build.gradle.kts index 2eebd77a1d..4c4e80d9a3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ apply(plugin = "io.github.gradle-nexus.publish-plugin") apply(plugin = "org.jetbrains.dokka") +apply(from = "${rootDir}/scripts/sonar.gradle") buildscript { repositories { @@ -7,6 +8,14 @@ buildscript { mavenCentral() maven("https://plugins.gradle.org/m2/") } + + dependencies { + // TODO: Remove this workaround after AGP 8.9.0 is released + // Workaround for integrate sonarqube plugin with AGP + // It looks like will be fixed after AGP 8.9.0-alpha04 is released + // https://issuetracker.google.com/issues/380600747?pli=1 + classpath("org.bouncycastle:bcutil-jdk18on:1.79") + } } @Suppress("DSL_SCOPE_VIOLATION") @@ -27,6 +36,8 @@ plugins { alias(libs.plugins.hilt) apply false alias(libs.plugins.play.publisher) apply false alias(libs.plugins.baseline.profile) apply false + alias(libs.plugins.sonarqube) apply false + alias(libs.plugins.kover) apply false } subprojects { @@ -47,6 +58,8 @@ subprojects { ) } } + + apply(from = "${rootDir}/scripts/coverage.gradle") } tasks.register("clean") diff --git a/fastlane/.env b/fastlane/.env new file mode 100644 index 0000000000..50432c3586 --- /dev/null +++ b/fastlane/.env @@ -0,0 +1,4 @@ +FASTLANE_SKIP_ACTION_SUMMARY=true +FASTLANE_HIDE_PLUGINS_TABLE=true +FASTLANE_SKIP_UPDATE_CHECK=true +FASTLANE_HIDE_CHANGELOG=true diff --git a/fastlane/.rubocop.yml b/fastlane/.rubocop.yml new file mode 100755 index 0000000000..8fbc948034 --- /dev/null +++ b/fastlane/.rubocop.yml @@ -0,0 +1,172 @@ +--- +require: +- rubocop/require_tools +- rubocop-performance +AllCops: + TargetRubyVersion: 2.4 + NewCops: enable + Include: + - "**/*.rb" + - "**/*file" +Style/MultipleComparison: + Enabled: false +Style/PercentLiteralDelimiters: + Enabled: false +Style/ClassCheck: + EnforcedStyle: kind_of? +Style/FrozenStringLiteralComment: + Enabled: false +Style/SafeNavigation: + Enabled: false +Performance/RegexpMatch: + Enabled: false +Performance/StringReplacement: + Enabled: false +Performance/CollectionLiteralInLoop: + Enabled: false +Style/NumericPredicate: + Enabled: false +Metrics/BlockLength: + Enabled: false +Metrics/ModuleLength: + Enabled: false +Naming/VariableNumber: + Enabled: false +Style/MissingRespondToMissing: + Enabled: false +Style/MultilineBlockChain: + Enabled: false +Style/NumericLiteralPrefix: + Enabled: false +Style/TernaryParentheses: + Enabled: false +Style/EmptyMethod: + Enabled: false +Lint/UselessAssignment: + Exclude: + - "**/spec/**/*" +Require/MissingRequireStatement: + Enabled: false +Style/RescueModifier: + Enabled: false +Layout/FirstHashElementIndentation: + Enabled: false +Layout/HashAlignment: + Enabled: false +Layout/DotPosition: + Enabled: false +Style/DoubleNegation: + Enabled: false +Style/SymbolArray: + Enabled: false +Layout/HeredocIndentation: + Enabled: false +Style/MixinGrouping: + Exclude: + - "**/spec/**/*" +Lint/SuppressedException: + Enabled: false +Lint/UnusedBlockArgument: + Enabled: false +Lint/AmbiguousBlockAssociation: + Enabled: false +Style/GlobalVars: + Enabled: false +Style/ClassAndModuleChildren: + Enabled: false +Style/SpecialGlobalVars: + Enabled: false +Metrics/AbcSize: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Style/WordArray: + MinSize: 19 +Style/SignalException: + Enabled: false +Style/RedundantReturn: + Enabled: false +Style/IfUnlessModifier: + Enabled: false +Style/AndOr: + Enabled: true + EnforcedStyle: conditionals +Metrics/ClassLength: + Max: 320 +Layout/LineLength: + Max: 370 +Metrics/ParameterLists: + Max: 17 +Metrics/PerceivedComplexity: + Max: 20 +Style/GuardClause: + Enabled: false +Style/StringLiterals: + Enabled: false +Style/ConditionalAssignment: + Enabled: false +Style/RedundantSelf: + Enabled: false +Lint/UnusedMethodArgument: + Enabled: false +Lint/ParenthesesAsGroupedExpression: + Exclude: + - "**/spec/**/*" +Naming/PredicateName: + Enabled: false +Style/PerlBackrefs: + Enabled: false +Naming/FileName: + Exclude: + - "**/Dangerfile" + - "**/Brewfile" + - "**/Gemfile" + - "**/Podfile" + - "**/Rakefile" + - "**/Fastfile" + - "**/Scanfile" + - "**/Matchfile" + - "**/Appfile" + - "**/Allurefile" + - "**/Sonarfile" + - "**/Deliverfile" + - "**/Snapfile" + - "**/Pluginfile" + - "**/*.gemspec" +Style/Documentation: + Enabled: false +Style/MutableConstant: + Enabled: false +Style/ZeroLengthPredicate: + Enabled: false +Style/IfInsideElse: + Enabled: false +Style/CollectionMethods: + Enabled: false +Style/MethodCallWithArgsParentheses: + Enabled: true + IgnoredMethods: + - require + - require_relative + - fastlane_require + - gem + - program + - command + - raise + - attr_accessor + - attr_reader + - desc + - lane + - private_lane + - platform + - to + - not_to + - describe + - it + - be + - context + - before + - after + - and diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000000..71a4cf8878 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,34 @@ +default_platform :android +skip_docs + +require 'json' +require 'net/http' + +@force_check = false + +before_all do |lane| + if is_ci + setup_ci + setup_git_config + end +end + +lane :run_sonar_analysis do |options| + next unless is_check_required(sources: sources_matrix[:sonar], force_check: @force_check) + + Dir.chdir('..') { sh('./gradlew sonar') } +end + +desc 'Run fastlane linting' +lane :rubocop do + next unless is_check_required(sources: sources_matrix[:ruby], force_check: @force_check) + + sh('bundle exec rubocop') +end + +private_lane :sources_matrix do + { + sonar: ['stream-video-android-'], + ruby: ['fastlane', 'Gemfile', 'Gemfile.lock'] + } +end diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile new file mode 100644 index 0000000000..5daeada579 --- /dev/null +++ b/fastlane/Pluginfile @@ -0,0 +1,5 @@ +# Autogenerated by fastlane +# +# Ensure this file is checked in to source control! + +gem 'fastlane-plugin-stream_actions', '0.3.74' diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5bbfe9e653..a452008786 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,8 @@ [versions] androidGradlePlugin = "8.4.2" cameraCamera2 = "1.3.4" +kover = "0.9.1" +sonarqube = "6.0.1.5171" spotless = "6.21.0" nexusPlugin = "1.3.0" kotlin = "1.9.25" @@ -221,6 +223,8 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi kotlin-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompatabilityValidator" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover"} +sonarqube = { id = "org.sonarqube", version.ref = "sonarqube"} spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } dokka = { id = "org.jetbrains.dokka", version.ref = "kotlinDokka" } nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPlugin" } diff --git a/scripts/coverage.gradle b/scripts/coverage.gradle new file mode 100644 index 0000000000..f7e9754559 --- /dev/null +++ b/scripts/coverage.gradle @@ -0,0 +1,32 @@ +if (!rootProject.ext.sonar.ignoreModules.contains(name)) { + apply plugin: "org.jetbrains.kotlinx.kover" + apply plugin: "org.sonarqube" + + if (hasProperty('android')) { + android { + buildTypes { + debug { + testCoverageEnabled = true + enableUnitTestCoverage = true + enableAndroidTestCoverage true + } + } + } + } + + kover { + reports { + verify { + warningInsteadOfFailure = true + } + } + } + + sonarqube { + properties { + property "sonar.junit.reportPaths", "${buildDir}/test-results/testDebugUnitTest" + property "sonar.coverage.jacoco.xmlReportPaths", "${buildDir}/reports/kover/report.xml" + property "sonar.sources", "src/main/kotlin" + } + } +} diff --git a/scripts/sonar.gradle b/scripts/sonar.gradle new file mode 100644 index 0000000000..99b0ed5442 --- /dev/null +++ b/scripts/sonar.gradle @@ -0,0 +1,44 @@ +apply plugin: "org.sonarqube" + +ext.sonar = [ + ignoreModules : [ + 'stream-video-android-bom', + 'stream-video-android-previewdata', + 'demo-app', + 'benchmark', + 'tutorials', + 'tutorial-audio', + 'tutorial-video', + 'tutorial-ringing', + 'tutorial-livestream', + 'metrics' + ], + excludeFilter : [ + '**/test/**', + '**/androidTest/**', + '**/R.class', + '**/R2.class', + '**/R$*.class', + '**/BuildConfig.*', + '**/Manifest*.*', + '**/*Test*.*' + ] +] + +ext.sonar.ignoreModules.each { + ext.sonar.excludeFilter << "**/${it}/**" +} + +sonarqube { + properties { + property("sonar.host.url", "https://sonarcloud.io") + property("sonar.token", "${System.getenv("SONAR_TOKEN")}") + property("sonar.organization", "getstream") + property("sonar.projectKey", "GetStream_stream-video-android") + property("sonar.projectName", "stream-video-android") + property "sonar.java.coveragePlugin", "jacoco" + property "sonar.sourceEncoding", "UTF-8" + property "sonar.java.binaries", "${rootDir}/**/build/tmp/kotlin-classes/debug" + property "sonar.coverage.exclusions", rootProject.ext.sonar.excludeFilter + } +}