diff --git a/.github/workflows/knative-java-test.yaml b/.github/workflows/knative-java-test.yaml index 30f6d60c94..a132a52f32 100644 --- a/.github/workflows/knative-java-test.yaml +++ b/.github/workflows/knative-java-test.yaml @@ -53,6 +53,9 @@ jobs: - name: Java Test run: ./hack/run.sh unit-tests-data-plane + - name: Code Formatting Check + run: ./hack/run.sh format-check + - if: steps.codecov-enabled.outputs.files_exists == 'true' name: Codecov uses: codecov/codecov-action@v1 diff --git a/hack/run.sh b/hack/run.sh index 73c52441d3..0772b9b9e3 100755 --- a/hack/run.sh +++ b/hack/run.sh @@ -104,6 +104,9 @@ elif [[ "${action}" == "integration-test" ]]; then elif [[ "${action}" == "format-java" ]]; then cd "${ROOT_DIR}/data-plane" ./mvnw spotless:apply +elif [[ "${action}" == "format-check" ]]; then + cd "${ROOT_DIR}/data-plane" + ./mvnw spotless:check else echo "Unrecognized action ${action}" usage "$0" diff --git a/test/presubmit-tests.sh b/test/presubmit-tests.sh index 1757f5c280..f1fd62b9ca 100755 --- a/test/presubmit-tests.sh +++ b/test/presubmit-tests.sh @@ -35,6 +35,12 @@ function fail_test() { function build_tests() { header "Running control plane build tests" default_build_test_runner || fail_test "Control plane build tests failed" + + header "Running data plane formatting tests" + + cd $(dirname "$0")/../data-plane || fail_test "Failed to change to the data plane directory" + ./mvnw spotless:check || fail_test "data plane formatting check failed" + cd - || fail_test "Failed to return to the original directory" } function unit_tests() {