Skip to content

Commit

Permalink
Merge pull request #1605 from Adyen/fix/sonar-build-time
Browse files Browse the repository at this point in the history
Speed up sonar
  • Loading branch information
OscarSpruit authored May 3, 2024
2 parents 4f850d8 + ba91dd8 commit d571501
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/assemble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
run: chmod +x gradlew

- name: Run assembleDebug
run: ./gradlew assDeb --no-daemon
run: ./gradlew assDeb -Pstrip-resources=true
2 changes: 1 addition & 1 deletion .github/workflows/check_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:

# Run gradlew check
- name: Gradle check
run: ./gradlew check --no-daemon
run: ./gradlew check
4 changes: 2 additions & 2 deletions .github/workflows/code_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: chmod +x gradlew

- name: Run detekt
run: ./gradlew detekt --no-daemon
run: ./gradlew detekt -Pstrip-resources=true

ktlint:
name: Run ktlint
Expand All @@ -50,4 +50,4 @@ jobs:
run: chmod +x gradlew

- name: Run ktlint
run: ./gradlew ktlint --no-daemon
run: ./gradlew ktlint -Pstrip-resources=true
2 changes: 1 addition & 1 deletion .github/workflows/publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

# Generate kdocs
- name: Generate Dokka HTML documentation
run: ./gradlew dokkaHtmlMultiModule --no-daemon
run: ./gradlew dokkaHtmlMultiModule

# Deploy to GitHub Pages
- name: Deploy GitHub Pages
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: chmod +x gradlew

- name: Gradle check
run: ./gradlew check --no-daemon
run: ./gradlew check

# TODO: add more tests or rely on check_release workflow?

Expand All @@ -46,7 +46,7 @@ jobs:
# Packages and publishes to Maven Central
- name: Publish to Maven Central
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 --stacktrace --no-daemon
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 --stacktrace
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: chmod +x gradlew

- name: Run testDebugUnitTest
run: ./gradlew testDebugUnitTest --no-daemon
run: ./gradlew testDebugUnitTest -Pstrip-resources=true

lint:
name: Run lint
Expand All @@ -50,4 +50,4 @@ jobs:
run: chmod +x gradlew

- name: Run lintDebug
run: ./gradlew lintDebug --no-daemon
run: ./gradlew lintDebug -Pstrip-resources=true
2 changes: 1 addition & 1 deletion .github/workflows/run_ui_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jobs:
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew connectedDebugAndroidTest
script: ./gradlew connectedDebugAndroidTest -Pstrip-resources=true
2 changes: 1 addition & 1 deletion .github/workflows/sonar_cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew detekt assDeb teDebUnTe jacocoDebugTestReport lintDeb sonar
run: ./gradlew detekt assDeb jacocoDebugTestReport lintDeb sonar -Dsonar.gradle.skipCompile=true -Pstrip-resources=true
2 changes: 1 addition & 1 deletion .github/workflows/update_verification_metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: chmod +x gradlew

- name: Gradle update verification metadata
run: ./gradlew --write-verification-metadata sha256 build --no-daemon
run: ./gradlew --write-verification-metadata sha256 build

- name: Commit
run: |
Expand Down
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ subprojects {

plugins.withType(com.android.build.gradle.BasePlugin).configureEach {
android {
if (project.hasProperty("strip-resources") && project.property("strip-resources") == "true") {
defaultConfig {
resConfigs "en", "xxhdpi"
}

buildTypes {
debug {
crunchPngs false
}
}
}

compileOptions {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ org.gradle.configureondemand=true
# https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching=true

# Enable configuration cache, so Gradle will try to re-use configuration outputs from previous builds.
org.gradle.configuration-cache=true

# Enable caching for KAPT.
# Size should be equal to amount of modules that use kapt.
kapt.classloaders.cache.size=1
Expand Down

0 comments on commit d571501

Please sign in to comment.