2020-12-20 17:08:29 +01:00
|
|
|
name: Code Quality Checks
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '**'
|
2020-12-20 17:43:56 +01:00
|
|
|
paths:
|
2020-12-28 18:27:16 +01:00
|
|
|
- '.github/workflows/**'
|
2020-12-20 18:53:16 +01:00
|
|
|
- 'AnkiDroid/**'
|
|
|
|
- 'api/**'
|
|
|
|
- 'lint-rules/**'
|
|
|
|
- 'annotations/**'
|
2020-12-20 17:43:56 +01:00
|
|
|
- '**/*.gradle'
|
2020-12-20 18:53:16 +01:00
|
|
|
- 'gradle/**'
|
2020-12-20 17:08:29 +01:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-12-20 20:42:28 +01:00
|
|
|
- i18n_sync
|
2021-05-14 16:28:30 +02:00
|
|
|
- dependency-updates
|
2020-12-20 20:42:28 +01:00
|
|
|
- 'release**'
|
2020-12-20 17:43:56 +01:00
|
|
|
paths:
|
2020-12-28 18:27:16 +01:00
|
|
|
- '.github/workflows/**'
|
2020-12-20 18:53:16 +01:00
|
|
|
- 'AnkiDroid/**'
|
|
|
|
- 'api/**'
|
|
|
|
- 'lint-rules/**'
|
|
|
|
- 'annotations/**'
|
2020-12-20 17:43:56 +01:00
|
|
|
- '**/*.gradle'
|
2020-12-20 18:53:16 +01:00
|
|
|
- 'gradle/**'
|
2020-12-20 17:08:29 +01:00
|
|
|
|
|
|
|
jobs:
|
2022-02-11 16:43:05 +01:00
|
|
|
lintDebug:
|
|
|
|
name: Lint Debug
|
2020-12-20 17:08:29 +01:00
|
|
|
timeout-minutes: 15
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-07-30 01:12:38 +02:00
|
|
|
- uses: styfle/cancel-workflow-action@0.9.1
|
2021-04-16 01:36:23 +02:00
|
|
|
with:
|
|
|
|
all_but_latest: true
|
2020-12-20 17:08:29 +01:00
|
|
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 1
|
|
|
|
|
2021-03-19 19:57:40 +01:00
|
|
|
- name: Configure JDK 1.11
|
2021-04-16 01:36:23 +02:00
|
|
|
uses: actions/setup-java@v2
|
2020-12-20 17:08:29 +01:00
|
|
|
with:
|
2021-04-16 01:36:23 +02:00
|
|
|
distribution: "adopt"
|
2021-03-19 19:57:40 +01:00
|
|
|
java-version: "11" # ubuntu-latest is about to default to 11, force it everywhere
|
2020-12-20 17:08:29 +01:00
|
|
|
|
2021-03-19 19:57:40 +01:00
|
|
|
- name: Verify JDK11
|
|
|
|
# Default JDK varies depending on different runner flavors, make sure we are on 11
|
|
|
|
# Run a check that exits with error unless it is 11 version to future-proof against unexpected upgrades
|
|
|
|
run: java -fullversion 2>&1 | grep '11.0'
|
2020-12-20 17:08:29 +01:00
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Gradle Cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ~/.gradle/caches
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-v1
|
|
|
|
|
|
|
|
- name: Warm Gradle Cache
|
|
|
|
# This makes sure we fetch gradle network resources with a retry
|
|
|
|
uses: nick-invision/retry@v2
|
2020-12-20 17:12:33 +01:00
|
|
|
with:
|
|
|
|
timeout_minutes: 10
|
|
|
|
retry_wait_seconds: 60
|
|
|
|
max_attempts: 3
|
2022-02-11 16:43:05 +01:00
|
|
|
command: ./gradlew :AnkiDroid:compilePlayDebugJavaWithJavac compileLint lint-rules:compileTestJava
|
2020-12-20 17:08:29 +01:00
|
|
|
|
2022-02-11 16:43:05 +01:00
|
|
|
- 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
|
|
|
|
run: ./gradlew lintPlayDebug :api:lintDebug
|
2021-01-27 12:52:21 +01:00
|
|
|
|
|
|
|
- name: Test Lint Rules
|
|
|
|
run: ./gradlew lint-rules:test
|
2021-05-27 07:41:13 +02:00
|
|
|
|
|
|
|
- name: Ktlint Check
|
|
|
|
run: ./gradlew ktlintCheck
|