Skip to content
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

Add Code formatting check post Pull-Request (#3349) #4028

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .github/workflows/knative-java-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions hack/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions test/presubmit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down