Skip to content
Snippets Groups Projects
Commit 02dd28e4 authored by Sebastian's avatar Sebastian
Browse files

Merge branch 'ci' into 'main'

Add CI config with code-style checking

See merge request !3
parents 3973b619 5c553e25
No related branches found
No related tags found
1 merge request!3Add CI config with code-style checking
Pipeline #7187 passed
image: briar/ci-image-android:latest
stages:
- test
workflow:
# when to create a CI pipeline
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never # avoids duplicate jobs for branch and MR
- if: '$CI_COMMIT_BRANCH'
- if: '$CI_COMMIT_TAG'
test:
stage: test
before_script:
- set -e
- export GRADLE_USER_HOME=$PWD/.gradle
script:
- ./gradlew --no-daemon check lint
after_script:
# these file change every time and should not be cached
- rm -f $GRADLE_USER_HOME/caches/modules-2/modules-2.lock
- rm -fr $GRADLE_USER_HOME/caches/*/plugin-resolution/
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- .gradle/wrapper
- .gradle/caches
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: always
- when: always
ktlint {
version = "0.41.0"
android = true
enableExperimentalRules = false
verbose = true
disabledRules = [
"import-ordering",
"no-blank-line-before-rbrace",
"indent", // remove in 0.42 https://github.com/pinterest/ktlint/issues/764
]
}
...@@ -3,6 +3,7 @@ plugins { ...@@ -3,6 +3,7 @@ plugins {
id 'kotlin-android' id 'kotlin-android'
id 'kotlin-kapt' id 'kotlin-kapt'
id 'dagger.hilt.android.plugin' id 'dagger.hilt.android.plugin'
id "org.jlleitschuh.gradle.ktlint" version "10.1.0"
} }
android { android {
...@@ -36,9 +37,9 @@ android { ...@@ -36,9 +37,9 @@ android {
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.0' implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "androidx.activity:activity-ktx:1.2.3" implementation "androidx.activity:activity-ktx:1.2.4"
implementation "androidx.fragment:fragment-ktx:1.3.5" implementation "androidx.fragment:fragment-ktx:1.3.6"
def lifecycle_version = "2.3.1" def lifecycle_version = "2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
...@@ -55,3 +56,5 @@ dependencies { ...@@ -55,3 +56,5 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
} }
apply from: "${rootProject.rootDir}/gradle/ktlint.gradle"
...@@ -7,4 +7,4 @@ interface ApplicationComponent { ...@@ -7,4 +7,4 @@ interface ApplicationComponent {
fun inject(activity: MainActivity) fun inject(activity: MainActivity)
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment