0
0
mirror of https://github.com/ankidroid/Anki-Android.git synced 2024-09-20 12:02:16 +02:00
Anki-Android/.github/workflows/lint.yml

80 lines
2.5 KiB
YAML
Raw Normal View History

name: Code Quality Checks
on:
workflow_dispatch:
inputs:
clearCaches:
description: "Clear workflow caches where possible"
required: false
type: string
pull_request:
push:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lintDebug:
name: Lint Debug
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"
Dependency updates 20230628 (#14046) * Bump org.jlleitschuh.gradle:ktlint-gradle from 11.4.1 to 11.4.2 Bumps org.jlleitschuh.gradle:ktlint-gradle from 11.4.1 to 11.4.2. --- updated-dependencies: - dependency-name: org.jlleitschuh.gradle:ktlint-gradle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): require JDK17 for the build, use JDK17 in workflows 17+ is a requirement for new AndroidX library versions, fragment library lint rules in particular are already failing our lint workflow because they no longer operate on JDK11 * Bump lint_version from 30.4.2 to 31.0.2 Bumps `lint_version` from 30.4.2 to 31.0.2. Updates `com.android.tools.lint:lint-api` from 30.4.2 to 31.0.2 Updates `com.android.tools.lint:lint` from 30.4.2 to 31.0.2 Updates `com.android.tools.lint:lint-tests` from 30.4.2 to 31.0.2 --- updated-dependencies: - dependency-name: com.android.tools.lint:lint-api dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.android.tools.lint:lint dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.android.tools.lint:lint-tests dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * build: bump JDK source/target compat to JDK11 This is needed for new versions of deps, it passes jacocoAndroidTestReport target against an API21 emulator (current minSdkVersion) so seems to be compatible with all required things * Bump org.mockito.kotlin:mockito-kotlin from 4.1.0 to 5.0.0 Bumps [org.mockito.kotlin:mockito-kotlin](https://github.com/mockito/mockito-kotlin) from 4.1.0 to 5.0.0. - [Release notes](https://github.com/mockito/mockito-kotlin/releases) - [Commits](https://github.com/mockito/mockito-kotlin/compare/4.1.0...5.0.0) --- updated-dependencies: - dependency-name: org.mockito.kotlin:mockito-kotlin dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): have gradle wrapper update PRs go into dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 18:06:44 +02:00
java-version: "17" # newer libraries require 17 now, force it everywhere
Dependency updates 20230628 (#14046) * Bump org.jlleitschuh.gradle:ktlint-gradle from 11.4.1 to 11.4.2 Bumps org.jlleitschuh.gradle:ktlint-gradle from 11.4.1 to 11.4.2. --- updated-dependencies: - dependency-name: org.jlleitschuh.gradle:ktlint-gradle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): require JDK17 for the build, use JDK17 in workflows 17+ is a requirement for new AndroidX library versions, fragment library lint rules in particular are already failing our lint workflow because they no longer operate on JDK11 * Bump lint_version from 30.4.2 to 31.0.2 Bumps `lint_version` from 30.4.2 to 31.0.2. Updates `com.android.tools.lint:lint-api` from 30.4.2 to 31.0.2 Updates `com.android.tools.lint:lint` from 30.4.2 to 31.0.2 Updates `com.android.tools.lint:lint-tests` from 30.4.2 to 31.0.2 --- updated-dependencies: - dependency-name: com.android.tools.lint:lint-api dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.android.tools.lint:lint dependency-type: direct:production update-type: version-update:semver-major - dependency-name: com.android.tools.lint:lint-tests dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * build: bump JDK source/target compat to JDK11 This is needed for new versions of deps, it passes jacocoAndroidTestReport target against an API21 emulator (current minSdkVersion) so seems to be compatible with all required things * Bump org.mockito.kotlin:mockito-kotlin from 4.1.0 to 5.0.0 Bumps [org.mockito.kotlin:mockito-kotlin](https://github.com/mockito/mockito-kotlin) from 4.1.0 to 5.0.0. - [Release notes](https://github.com/mockito/mockito-kotlin/releases) - [Commits](https://github.com/mockito/mockito-kotlin/compare/4.1.0...5.0.0) --- updated-dependencies: - dependency-name: org.mockito.kotlin:mockito-kotlin dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * build(deps): have gradle wrapper update PRs go into dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 18:06:44 +02:00
- name: Verify JDK17
# Default JDK varies depending on different runner flavors, make sure we are on 17
# Run a check that exits with error unless it is 17 version to future-proof against unexpected upgrades
run: java -fullversion 2>&1 | grep '17.0'
shell: bash
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
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' }}
gradle-home-cache-cleanup: true
- name: Clear Caches Optionally
if: "${{ github.event.inputs.clearCaches != '' }}"
shell: bash
run: |
du -sk ~/.gradle
rm -fr ~/.gradle
du -sk ~/.gradle || echo ~/.gradle is gone
- name: Warm Gradle Cache
# This makes sure we fetch gradle network resources with a retry
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
retry_wait_seconds: 60
max_attempts: 3
command: ./gradlew :AnkiDroid:compilePlayDebugJavaWithJavac compileLint lint-rules:compileTestJava --daemon
- name: Run Lint Debug
uses: gradle/gradle-build-action@v2
with:
# "lint" is run under the 'Amazon' flavor, so slow in CI
# "lintPlayRelease" doesn't test androidTest
# "lintPlayDebug" doesn't test the API
arguments: lintPlayDebug :api:lintDebug ktLintCheck lint-rules:test --daemon
- name: Prettify code
uses: creyD/prettier_action@v4.3
with:
prettier_options: --check AnkiDroid/**/*.js
dry: True