Skip to content

Commit

Permalink
Refactor- Final Cleanup (#2694)
Browse files Browse the repository at this point in the history
  • Loading branch information
niyajali authored Sep 4, 2024
1 parent 25389dd commit 9c0a9b6
Show file tree
Hide file tree
Showing 579 changed files with 52,556 additions and 15,674 deletions.
186 changes: 169 additions & 17 deletions .github/workflows/feature_branch_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,180 @@ on:
- '!development'
- '!master'

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
build:
name: Build APK
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- uses: gradle/actions/setup-gradle@v4

- name: Cache Gradle and build outputs
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
build
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

checks:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
check: [ build_logic, spotless, detekt ]
steps:
- name: Checking out repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Run ${{ matrix.check }}
id: run_check
run: |
if [ "${{ matrix.check }}" = "build_logic" ]; then
./gradlew check -p build-logic
elif [ "${{ matrix.check }}" = "spotless" ]; then
./gradlew spotlessCheck --no-configuration-cache --no-daemon
elif [ "${{ matrix.check }}" = "detekt" ]; then
./gradlew detekt
fi
# Set up JDK
- name: Set Up JDK 1.8
uses: actions/setup-java@v1
- name: Upload Detekt Reports
if: ${{ matrix.check == 'detekt' && steps.run_check.outcome == 'success' }}
uses: actions/upload-artifact@v4
with:
java-version: 11
name: detekt-reports
path: |
**/build/reports/detekt/detekt.md
# Install NDK
- name: Install NDK
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
# Update Gradle Permission
- name: Change gradlew Permission
run: chmod +x gradlew
# Build App
- name: Build with Gradle
run: ./gradlew assemble
dependency_guard:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Check Dependency Guard
id: dependencyguard_verify
continue-on-error: true
run: ./gradlew dependencyGuard

- name: Prevent updating Dependency Guard baselines if this is a fork
id: checkfork_dependencyguard
if: steps.dependencyguard_verify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::Dependency Guard failed, please update baselines with: ./gradlew dependencyGuardBaseline" && exit 1
# Runs if previous job failed
- name: Generate new Dependency Guard baselines if verification failed and it's a PR
id: dependencyguard_baseline
if: steps.dependencyguard_verify.outcome == 'failure' && github.event_name == 'pull_request'
run: |
./gradlew dependencyGuardBaseline
- name: Push new Dependency Guard baselines if available
uses: stefanzweifel/git-auto-commit-action@v5
if: steps.dependencyguard_baseline.outcome == 'success'
with:
file_pattern: '**/dependencies/*.txt'
disable_globbing: true
commit_message: "🤖 Updates baselines for Dependency Guard"

tests_and_lint:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Run tests
run: |
./gradlew testDebug :lint:test :androidApp:lintRelease :lint:lint
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-and-lint-reports
path: |
**/build/reports/lint-results-*.html
**/build/test-results/test*UnitTest/**.xml
# Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod
- name: Generate coverage reports for Debug variants (only API 30)
run: ./gradlew createDebugCombinedCoverageReport

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.api-level }}
path: '**/build/reports/androidTests'

- name: Display local test coverage (only API 30)
id: jacoco
uses: madrapps/[email protected]
with:
title: Combined test coverage report
min-coverage-overall: 40
min-coverage-changed-files: 60
paths: |
${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml
token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload local coverage reports (XML + HTML) (only API 30)
uses: actions/upload-artifact@v4
with:
name: coverage-reports
if-no-files-found: error
compression-level: 1
overwrite: false
path: '**/build/reports/jacoco/'

build:
needs: [ checks, dependency_guard, tests_and_lint ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Build APKs
run: ./gradlew :androidApp:assembleDebug

- name: Check badging
run: ./gradlew :androidApp:checkReleaseBadging

- name: Upload APKs
uses: actions/upload-artifact@v4
with:
name: APKs
path: '**/build/outputs/apk/**/*.apk'
170 changes: 158 additions & 12 deletions .github/workflows/master_dev_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ on:
- 'development'
- 'master'

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
build:
name: Build APK
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- uses: gradle/actions/setup-gradle@v4

- name: Cache Gradle and build outputs
uses: actions/cache@v4
Expand All @@ -34,7 +36,151 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Build With Gradle
run: ./gradlew assembleDebug
checks:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
check: [ build_logic, spotless, detekt ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
- name: Run ${{ matrix.check }}
id: run_check
run: |
if [ "${{ matrix.check }}" = "build_logic" ]; then
./gradlew check -p build-logic
elif [ "${{ matrix.check }}" = "spotless" ]; then
./gradlew spotlessCheck --no-configuration-cache --no-daemon
elif [ "${{ matrix.check }}" = "detekt" ]; then
./gradlew detekt
fi
- name: Upload Detekt Reports
if: ${{ matrix.check == 'detekt' && steps.run_check.outcome == 'success' }}
uses: actions/upload-artifact@v4
with:
name: detekt-reports
path: |
**/build/reports/detekt/detekt.md
dependency_guard:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Check Dependency Guard
id: dependencyguard_verify
continue-on-error: true
run: ./gradlew dependencyGuard

- name: Prevent updating Dependency Guard baselines if this is a fork
id: checkfork_dependencyguard
if: steps.dependencyguard_verify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::Dependency Guard failed, please update baselines with: ./gradlew dependencyGuardBaseline" && exit 1
# Runs if previous job failed
- name: Generate new Dependency Guard baselines if verification failed and it's a PR
id: dependencyguard_baseline
if: steps.dependencyguard_verify.outcome == 'failure' && github.event_name == 'pull_request'
run: |
./gradlew dependencyGuardBaseline
- name: Push new Dependency Guard baselines if available
uses: stefanzweifel/git-auto-commit-action@v5
if: steps.dependencyguard_baseline.outcome == 'success'
with:
file_pattern: '**/dependencies/*.txt'
disable_globbing: true
commit_message: "🤖 Updates baselines for Dependency Guard"

tests_and_lint:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Run tests
run: |
./gradlew testDebug :lint:test :androidApp:lintRelease :lint:lint
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-and-lint-reports
path: |
**/build/reports/lint-results-*.html
**/build/test-results/test*UnitTest/**.xml
# Add `createDebugUnitTestCoverageReport` if we ever add JVM tests for prod
- name: Generate coverage reports for Debug variants (only API 30)
run: ./gradlew createDebugCombinedCoverageReport

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.api-level }}
path: '**/build/reports/androidTests'

- name: Display local test coverage (only API 30)
id: jacoco
uses: madrapps/[email protected]
with:
title: Combined test coverage report
min-coverage-overall: 40
min-coverage-changed-files: 60
paths: |
${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml
token: ${{ secrets.GITHUB_TOKEN }}

- name: Upload local coverage reports (XML + HTML) (only API 30)
uses: actions/upload-artifact@v4
with:
name: coverage-reports
if-no-files-found: error
compression-level: 1
overwrite: false
path: '**/build/reports/jacoco/'

build:
needs: [ checks, dependency_guard, tests_and_lint ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17

- name: Build APKs
run: ./gradlew :androidApp:assembleDebug

- name: Check badging
run: ./gradlew :androidApp:checkReleaseBadging

- name: Upload APKs
uses: actions/upload-artifact@v4
with:
name: APKs
path: '**/build/outputs/apk/**/*.apk'

Loading

0 comments on commit 9c0a9b6

Please sign in to comment.