Skip to content

Commit

Permalink
ci: add caching (#1183)
Browse files Browse the repository at this point in the history
* ci: add caching

Add caching when building off master, and use the caches in the ci file.

* ci: minor step name change

* ci: publish unit test results to PR

* ci: fix unit test results pathing

* ci: remove junit from danger plugin

Remove as it has never been used.
  • Loading branch information
Chesire authored Feb 25, 2024
1 parent ca4ddd2 commit 369febd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 36 deletions.
33 changes: 6 additions & 27 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ master ]

jobs:
assemble:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -14,37 +14,16 @@ jobs:
with:
distribution: 'adopt'
java-version: 17
- name: setup gradle cache
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
- name: run assemble
run: ./gradlew assemble

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: run kover
run: ./gradlew koverMergedXmlReport
- uses: codecov/codecov-action@v4

analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17
- name: run lintDebug
- name: run lint
run: ./gradlew :app:lint
- name: run detektCheck
run: ./gradlew detektCheck
- name: upload linting results
uses: actions/upload-artifact@v4
with:
name: lint
path: build/reports/
15 changes: 15 additions & 0 deletions .github/workflows/pre-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
with:
distribution: 'adopt'
java-version: 17
- name: setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: run assemble
run: ./gradlew assemble

Expand All @@ -25,9 +27,18 @@ jobs:
with:
distribution: 'adopt'
java-version: 17
- name: setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: run kover
run: ./gradlew koverMergedXmlReport
- uses: codecov/codecov-action@v4
- name: publish results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: ./**/build/test-results/**/*.xml
action_fail: true
action_fail_on_inconclusive: true

ktlint:
runs-on: ubuntu-latest
Expand All @@ -38,6 +49,8 @@ jobs:
with:
distribution: 'adopt'
java-version: 17
- name: setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: run ktlintCheck
run: ./gradlew ktlintCheck

Expand All @@ -52,6 +65,8 @@ jobs:
with:
distribution: 'adopt'
java-version: 17
- name: setup gradle cache
uses: gradle/actions/setup-gradle@v3
- name: run lint
run: ./gradlew :app:lint
- name: run detektCheck
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 0 additions & 8 deletions Dangerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,3 @@ end
# CheckstyleFormat
checkstyle_format.base_path = Dir.pwd
checkstyle_format.report 'build/reports/detekt/detekt.xml'

# JUnit
junit_tests_dir = "**/test-results/**/*.xml"
Dir[junit_tests_dir].each do |file_name|
junit.parse file_name
junit.show_skipped_tests = true
junit.report
end
7 changes: 7 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ subprojects {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
testOptions {
unitTests {
all {
it.ignoreFailures = true
}
}
}
}
configure<org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension> {
jvmToolchain(17)
Expand Down

0 comments on commit 369febd

Please sign in to comment.