forked from ankidroid/Anki-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (71 loc) · 2.66 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: 🛠️ Code Quality Checks
on:
workflow_dispatch:
pull_request:
push:
# Ignore merge queue branches on push; avoids merge_group+push concurrency race since ref is same
branches-ignore:
- 'gh-readonly-queue/**'
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lintKotlin:
name: Lint Kotlin
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
timeout-minutes: 5
with:
# Only write to the cache for builds on the 'main' branches, stops branches evicting main cache
# Builds on other branches will only read from main branch cache writes
# Comment this and the with: above out for performance testing on a branch
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
- name: Warm Gradle Cache
# This makes sure we fetch gradle network resources with a retry
uses: nick-invision/retry@v3
with:
timeout_minutes: 10
retry_wait_seconds: 60
max_attempts: 3
command: ./gradlew :AnkiDroid:compilePlayDebugJavaWithJavac compileLint lint-rules:compileTestJava --daemon
- name: Run Lint Debug
# "lint" is run under the 'Amazon' flavor, so slow in CI
# "lintPlayRelease" doesn't test androidTest
# "lintPlayDebug" doesn't test the API
# "lintVitalFullRelease": if `main` resources are only used in `androidTest` (#15741)
run: ./gradlew lintPlayDebug :api:lintDebug ktLintCheck lintVitalFullRelease lint-rules:test --daemon
lintJavascript:
name: Lint Javascript
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
# Handled under the pre-commit hook: ./gradlew installGitHook
# To run manually, run the following inside folder: Anki-Android
# npm install --location=global prettier
# prettier --check AnkiDroid/**/*.js
- name: Prettify AnkiDroid javascript code
uses: creyD/[email protected]
with:
prettier_options: --check AnkiDroid/**/*.js
dry: True
- name: Install Localization
run: cd tools/localization && yarn
- name: Lint Localization
run: cd tools/localization && yarn lint
- name: Format Localization
run: cd tools/localization && yarn checkformat