Add Linder to build CI

This commit is contained in:
Chemaclass 2023-03-07 19:09:26 +01:00
parent c4c8c0fbf7
commit 2d92e1d444
5 changed files with 15 additions and 14 deletions

View File

@ -27,6 +27,9 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Linter (gradle)
run: ./gradlew ktlintCheck
- name: Test (gradle) - name: Test (gradle)
run: ./gradlew test --no-daemon run: ./gradlew test --no-daemon

View File

@ -167,3 +167,7 @@ dependencies {
debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"
} }
ktlint {
disabledRules.set(["no-wildcard-imports"])
}

View File

@ -13,4 +13,11 @@ plugins {
id 'com.android.library' version '7.4.1' apply false id 'com.android.library' version '7.4.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.10' apply false id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
id 'org.jetbrains.kotlin.jvm' version '1.8.10' apply false id 'org.jetbrains.kotlin.jvm' version '1.8.10' apply false
} }
task installGitHook(type: Copy) {
from new File(rootProject.rootDir, 'pre-commit')
into { new File(rootProject.rootDir, '.git/hooks') }
fileMode 0777
}
tasks.getByPath(':app:preBuild').dependsOn installGitHook

View File

@ -1,13 +0,0 @@
#!/usr/bin/env bash
set -e
function setup_git_hooks()
{
echo "Initialising git hooks..."
ln -sf "$PWD/tools/git-hooks/pre-commit.sh" "$PWD/.git/hooks/pre-commit"
chmod +x "$PWD/.git/hooks/pre-commit"
echo "Done"
}
setup_git_hooks