diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f346aa0d82..3db05e8dfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,13 @@ jobs: check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.7 + + - name: Set up JDK + uses: actions/setup-java@v4.2.1 + with: + java-version: 17 + distribution: temurin - name: Clone Flutter SDK # We can't do a depth-1 clone, because we need the most recent tag diff --git a/android/app/build.gradle b/android/app/build.gradle index 4a8b1eb783..529221630b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,6 +74,16 @@ android { } } +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + // Compile Kotlin with `-Werror`... but only in release builds, so that it + // doesn't get in the way of quick local experiments for debugging. + // + // The string-searching makes this a bit of a mess, but it works. + // Better would be if we can add this to android.buildTypes.release above; + // but on a first attempt that didn't work (it affected debug builds too). + kotlinOptions.allWarningsAsErrors = name.contains("Release") +} + flutter { source '../..' } diff --git a/tools/check b/tools/check index 49df5cdc0a..3acb65a725 100755 --- a/tools/check +++ b/tools/check @@ -24,7 +24,12 @@ this_dir=${BASH_SOURCE[0]%/*} ## CLI PARSING -default_suites=(analyze test build_runner drift pigeon icons) +default_suites=( + analyze test + build_runner drift pigeon icons + android # This takes multiple minutes in CI, so do it last. +) + extra_suites=( shellcheck # Requires its own dependency, from outside the pub system. ) @@ -77,7 +82,7 @@ while (( $# )); do --all) opt_files=all; opt_all=1; shift;; --fix) opt_fix=1; shift;; --verbose) opt_verbose=1; shift;; - analyze|test|build_runner|drift|pigeon|icons|shellcheck) + analyze|test|build_runner|drift|pigeon|icons|android|shellcheck) opt_suites+=("$1"); shift;; *) usage;; esac @@ -351,6 +356,18 @@ run_icons() { check_no_changes "icon updates" "${outputs[@]}" } +run_android() { + # Omitted from this check: + # pubspec.{yaml,lock} tools/check + files_check android/ \ + || return 0 + + flutter build apk \ + || return + + flutter build appbundle +} + run_shellcheck() { # Omitted from this check: nothing (nothing known, anyway). files_check tools/ '!*.'{dart,js,json} \ @@ -424,6 +441,7 @@ for suite in "${opt_suites[@]}"; do drift) run_drift ;; pigeon) run_pigeon ;; icons) run_icons ;; + android) run_android ;; shellcheck) run_shellcheck ;; *) echo >&2 "Internal error: unknown suite $suite" ;; esac || failed+=( "$suite" )