Skip to content

Do Android build in CI #796

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]

- name: Set up JDK
uses: actions/[email protected]
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
Expand Down
10 changes: 10 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 '../..'
}
Expand Down
22 changes: 20 additions & 2 deletions tools/check
Original file line number Diff line number Diff line change
Expand Up @@ -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.
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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} \
Expand Down Expand Up @@ -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" )
Expand Down