ci: check android code formatting

Signed-off-by: Michael Nahkies <michael@nahkies.co.nz>
pull/697/head
Michael Nahkies 3 months ago
parent b42ab6b58f
commit ee90d0f92a

@ -35,3 +35,23 @@ jobs:
- name: Run tests
run: make test
fmt:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
with:
go-version-file: "go.mod"
- name: Switch to Java 17 # Note: 17 is pre-installed on ubuntu-latest
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
distribution: "temurin"
java-version: "17"
- name: Run fmt-check
run: make fmt-check

@ -321,7 +321,8 @@ fmt: gradle-dependencies ## Format the Android code
.PHONY: fmt-check
fmt-check: gradle-dependencies ## Check the Android code is formatted
(cd android && ./gradlew ktfmtCheck)
(cd android && ./gradlew ktfmtCheck) \
|| (echo -e "\033[1;31mfmt-check failed. Run 'make fmt' to fix.\033[0m" && exit 1)
.PHONY: emulator
emulator: ## Start an android emulator instance

@ -58,6 +58,9 @@ shell.
The ktmft plugin on the default setting should be used to autoformat all Java, Kotlin
and XML files in Android Studio. Enable "Format on Save".
This is checked in CI using `make fmt-check`, and you can also run reformat the files locally
using: `make fmt`
### Docker
If you wish to avoid installing software on your host system, a Docker based development strategy is available, you can build and start a shell with:

Loading…
Cancel
Save