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..56a1f97b68 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -12,6 +12,8 @@ env: 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 +22,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 +32,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 +41,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 +61,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:testDebugUnitTest :stream-video-android-ui-compose:testCoverage --scan --stacktrace + ./gradlew :stream-video-android-core:testDebugUnitTest :stream-video-android-core:testCoverage --scan --stacktrace - name: Unit tests core results uses: actions/upload-artifact@v4 @@ -112,6 +82,13 @@ 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 @@ -122,11 +99,7 @@ jobs: - 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 # 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..5942f13545 --- /dev/null +++ b/Gemfile @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' + +git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } + +gem 'danger', group: :danger_dependencies +gem 'fastlane', group: :fastlane_dependencies +gem 'jazzy' +gem 'json' +gem 'rubocop', '1.38', group: :rubocop_dependencies +gem 'sinatra', group: :sinatra_dependencies +gem 'slather' + +eval_gemfile('fastlane/Pluginfile') + +group :fastlane_dependencies do + gem 'cocoapods' + gem 'fastlane-plugin-lizard' + gem 'plist' + gem 'xcode-install' + gem 'xctest_list' +end + +group :sinatra_dependencies do + gem 'puma' + gem 'rackup' + gem 'stream-chat-ruby', '3.0.0' +end + +group :rubocop_dependencies do + gem 'rubocop-performance' + gem 'rubocop-require_tools' +end + +group :danger_dependencies do + gem 'danger-commit_lint' +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..11acbd1398 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,453 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.7) + base64 + nkf + rexml + activesupport (7.2.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + algoliasearch (1.27.5) + httpclient (~> 2.8, >= 2.8.3) + json (>= 1.5.1) + artifactory (3.0.17) + ast (2.4.2) + atomos (0.1.3) + aws-eventstream (1.3.0) + aws-partitions (1.987.0) + aws-sdk-core (3.209.1) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.9) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.94.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.167.0) + aws-sdk-core (~> 3, >= 3.207.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.10.0) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + base64 (0.2.0) + bigdecimal (3.1.8) + claide (1.1.0) + claide-plugins (0.9.2) + cork + nap + open4 (~> 1.3) + clamp (1.3.2) + cocoapods (1.15.2) + addressable (~> 2.8) + claide (>= 1.0.2, < 2.0) + cocoapods-core (= 1.15.2) + cocoapods-deintegrate (>= 1.0.3, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) + cocoapods-plugins (>= 1.0.0, < 2.0) + cocoapods-search (>= 1.0.0, < 2.0) + cocoapods-trunk (>= 1.6.0, < 2.0) + cocoapods-try (>= 1.1.0, < 2.0) + colored2 (~> 3.1) + escape (~> 0.0.4) + fourflusher (>= 2.3.0, < 3.0) + gh_inspector (~> 1.0) + molinillo (~> 0.8.0) + nap (~> 1.0) + ruby-macho (>= 2.3.0, < 3.0) + xcodeproj (>= 1.23.0, < 2.0) + cocoapods-core (1.15.2) + activesupport (>= 5.0, < 8) + addressable (~> 2.8) + algoliasearch (~> 1.0) + concurrent-ruby (~> 1.1) + fuzzy_match (~> 2.0.4) + nap (~> 1.0) + netrc (~> 0.11) + public_suffix (~> 4.0) + typhoeus (~> 1.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (2.1) + cocoapods-plugins (1.0.0) + nap + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) + nap (>= 0.8, < 2.0) + netrc (~> 0.11) + cocoapods-try (1.2.0) + coderay (1.1.3) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + cork (0.3.0) + colored2 (~> 3.1) + danger (9.5.0) + claide (~> 1.0) + claide-plugins (>= 0.9.2) + colored2 (~> 3.1) + cork (~> 0.1) + faraday (>= 0.9.0, < 3.0) + faraday-http-cache (~> 2.0) + git (~> 1.13) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.0) + octokit (>= 4.0) + terminal-table (>= 1, < 4) + danger-commit_lint (0.0.7) + danger-plugin-api (~> 1.0) + danger-plugin-api (1.0.0) + danger (> 2.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) + drb (2.2.1) + emoji_regex (3.2.3) + escape (0.0.4) + ethon (0.16.0) + ffi (>= 1.15.0) + 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-http-cache (2.5.1) + faraday (>= 0.8) + 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.224.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) + 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-lizard (1.3.3) + bundler + fastlane + pry + fastlane-plugin-stream_actions (0.3.74) + xctest_list (= 1.2.1) + ffi (1.17.0) + fourflusher (2.3.1) + fuzzy_match (2.0.4) + gh_inspector (1.1.3) + git (1.19.1) + addressable (~> 2.8) + rchardet (~> 1.8) + 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) + i18n (1.14.6) + concurrent-ruby (~> 1.0) + jazzy (0.15.2) + cocoapods (~> 1.5) + mustache (~> 1.1) + open4 (~> 1.3) + redcarpet (~> 3.4) + rexml (>= 3.2.7, < 4.0) + rouge (>= 2.0.6, < 5.0) + sassc (~> 2.1) + sqlite3 (~> 1.3) + xcinvoke (~> 0.3.0) + jmespath (1.6.2) + json (2.7.2) + jwt (2.9.3) + base64 + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + liferaft (0.0.6) + logger (1.6.1) + method_source (1.1.0) + mini_magick (4.13.2) + mini_mime (1.1.5) + mini_portile2 (2.8.7) + minitest (5.25.1) + molinillo (0.8.0) + multi_json (1.15.0) + multipart-post (2.4.1) + mustache (1.1.1) + mustermann (3.0.3) + ruby2_keywords (~> 0.0.1) + nanaimo (0.3.0) + nap (1.1.0) + naturally (2.2.1) + net-http-persistent (4.0.4) + connection_pool (~> 2.2) + netrc (0.11.0) + nio4r (2.7.3) + nkf (0.2.0) + nokogiri (1.16.7) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + octokit (9.1.0) + faraday (>= 1, < 3) + sawyer (~> 0.9) + open4 (1.3.4) + optparse (0.5.0) + os (1.1.4) + parallel (1.26.3) + parser (3.3.5.0) + ast (~> 2.4.1) + racc + plist (3.7.1) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.7) + 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.1.0) + rack (>= 3) + webrick (~> 1.8) + rainbow (3.1.1) + rake (13.2.1) + rchardet (1.8.0) + redcarpet (3.6.0) + 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.32.3) + 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-macho (2.5.1) + ruby-progressbar (1.13.0) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + sassc (2.4.0) + ffi (~> 1.9) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + securerandom (0.3.1) + 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) + slather (2.8.4) + CFPropertyList (>= 2.2, < 4) + activesupport + clamp (~> 1.3) + nokogiri (>= 1.14.3) + xcodeproj (~> 1.25) + sorbet-runtime (0.5.11600) + sqlite3 (1.7.3) + mini_portile2 (~> 2.8.0) + stream-chat-ruby (3.0.0) + faraday + faraday-multipart + faraday-net_http_persistent + jwt + net-http-persistent + sorbet-runtime + 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) + typhoeus (1.4.1) + ethon (>= 0.9.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uber (0.1.0) + unicode-display_width (2.6.0) + webrick (1.8.2) + word_wrap (1.0.0) + xcinvoke (0.3.0) + liferaft (~> 0.0.6) + xcode-install (2.8.1) + claide (>= 0.9.1) + fastlane (>= 2.1.0, < 3.0.0) + xcodeproj (1.25.1) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.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 + ruby + +DEPENDENCIES + cocoapods + danger + danger-commit_lint + fastlane + fastlane-plugin-lizard + fastlane-plugin-stream_actions (= 0.3.74) + jazzy + json + plist + puma + rackup + rubocop (= 1.38) + rubocop-performance + rubocop-require_tools + sinatra + slather + stream-chat-ruby (= 3.0.0) + xcode-install + xctest_list + +BUNDLED WITH + 2.3.10 diff --git a/build.gradle.kts b/build.gradle.kts index 2eebd77a1d..6c74aa7ae5 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,7 @@ 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 } subprojects { @@ -47,6 +57,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..6889e0014c --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,35 @@ +default_platform :android +skip_docs + +require 'json' +require 'net/http' +import 'Allurefile' + +@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-', 'scripts/sonar.gradle'], + 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..70e9e4b352 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,7 @@ [versions] androidGradlePlugin = "8.4.2" cameraCamera2 = "1.3.4" +sonarqube = "6.0.1.5171" spotless = "6.21.0" nexusPlugin = "1.3.0" kotlin = "1.9.25" @@ -221,6 +222,7 @@ 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" } +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..f633d42003 --- /dev/null +++ b/scripts/coverage.gradle @@ -0,0 +1,64 @@ +if (!rootProject.ext.sonar.ignoreModules.contains(name)) { + apply plugin: 'jacoco' + apply plugin: "org.sonarqube" + + def testTask = "testDebugUnitTest" + def jacocoResults = "${buildDir}/reports/jacoco/report.xml" + + if (hasProperty('android')) { + android { + buildTypes { + debug { + testCoverageEnabled = true + enableUnitTestCoverage = true + enableAndroidTestCoverage true + } + } + } + } + + afterEvaluate { + tasks.withType(Test).configureEach { + jacoco.includeNoLocationClasses = true + jacoco.excludes = [ + 'jdk.internal.*', + 'androidx.core.*', + 'com.android.*', + 'android.*' + ] + } + + tasks.register("testCoverage", JacocoReport) { + dependsOn testTask + + reports { + xml.required.set(true) + xml.outputLocation.set(file(jacocoResults)) + } + + executionData.setFrom(fileTree(dir: buildDir, includes: [ + "outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec", + "jacoco/test.exec" + ])) + + sourceDirectories.setFrom(files(android.sourceSets.main.java.srcDirs)) + classDirectories.setFrom(files([ + fileTree( + dir: "${buildDir}/tmp/kotlin-classes/debug", + excludes: rootProject.ext.sonar.excludeFilter + ), + fileTree( + dir: "${buildDir}/classes/kotlin/main", + excludes: rootProject.ext.sonar.excludeFilter + ) + ])) + } + } + + sonarqube { + properties { + property "sonar.junit.reportPaths", "${buildDir}/test-results/${testTask}" + property "sonar.coverage.jacoco.xmlReportPaths", jacocoResults + } + } +} diff --git a/scripts/sonar.gradle b/scripts/sonar.gradle new file mode 100644 index 0000000000..e39a3812bd --- /dev/null +++ b/scripts/sonar.gradle @@ -0,0 +1,37 @@ +apply plugin: "org.sonarqube" + +ext.sonar = [ + ignoreModules : [ + 'stream-video-android-bom', + 'tutorials', + '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,${rootDir}/**/build/classes/kotlin/main" + property "sonar.coverage.exclusions", rootProject.ext.sonar.excludeFilter + } +}