Skip to content

Commit

Permalink
[CI] Implement SonarCloud
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple committed Jan 8, 2025
1 parent 3b46d50 commit d4ae38d
Show file tree
Hide file tree
Showing 20 changed files with 879 additions and 76 deletions.
13 changes: 13 additions & 0 deletions .github/actions/gradle-cache/action.yml
Original file line number Diff line number Diff line change
@@ -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-
10 changes: 10 additions & 0 deletions .github/actions/setup-java/action.yml
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions .github/actions/setup-ruby/action.yml
Original file line number Diff line number Diff line change
@@ -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
63 changes: 18 additions & 45 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,11 +22,7 @@ jobs:
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
- uses: ./.github/actions/setup-java
- name: spotless
run: ./gradlew spotlessCheck --scan

Expand All @@ -34,11 +32,7 @@ jobs:
steps:
- name: Check out code
uses: actions/[email protected]
- name: Set up JDK
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
- uses: ./.github/actions/setup-java
- name: API check
run: ./gradlew apiCheck --scan

Expand All @@ -47,21 +41,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: set up JDK
uses: actions/[email protected]
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
Expand All @@ -79,26 +61,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: set up JDK
uses: actions/[email protected]
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
Expand All @@ -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
Expand All @@ -122,11 +99,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: 17
- uses: ./.github/actions/setup-java

# Sets gradle up
- name: Setup Gradle
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/app-distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/artifact-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/internal-app-distribute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- develop
workflow_dispatch:

jobs:
publish:
name: Snapshot build and publish
Expand All @@ -14,11 +14,7 @@ jobs:
- name: Check out code
uses: actions/[email protected]

- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
- uses: ./.github/actions/setup-java

- name: Release build
# assembleRelease for all modules, excluding non-library modules: samples, docs
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ jobs:
# with:
# ref: release

- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
- uses: ./.github/actions/setup-java

- name: Release build
# assembleRelease for all modules, excluding non-library modules: samples, docs
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/release-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ jobs:
uses: actions/[email protected]
with:
ref: main
- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: adopt
java-version: 17
- uses: ./.github/actions/setup-java
- name: Generate Dokka HTML docs
run: ./gradlew dokkaHtmlMultimodule
- name: Deploy to GitHub pages
Expand Down
38 changes: 38 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit d4ae38d

Please sign in to comment.