Skip to content

Commit cb30e85

Browse files
authored
Run all tests if gradle file is changed (#3006)
The tests are run using the `test-with-test-runner` script so that they are run with the Docker test runner. This ensures that changes to Gradle are tested in the test runner environment.
1 parent 902f1a6 commit cb30e85

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/java.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
if: failure()
5656

5757
test-changed:
58-
name: Test changed exercises using java-test-runner
58+
name: Test changed exercises using gradlew
5959
if: github.event_name == 'pull_request'
6060
runs-on: ubuntu-24.04
6161
steps:

bin/test-changed-exercise

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,16 @@ MERGE_BASE=$(git merge-base HEAD origin/"$BASE_BRANCH")
1313
# Get changed files relative to merge base
1414
changed_files=$(git diff --name-only "$MERGE_BASE" HEAD)
1515

16+
# If any Gradle build file changed, run the full suite and exit
17+
if echo "$changed_files" | grep -qE '\.(gradle|gradlew|bat)$|settings\.gradle'; then
18+
echo "Gradle build files changed, running full test suite..."
19+
./bin/test-with-test-runner
20+
exit 0
21+
fi
22+
1623
# Extract unique exercise directories
1724
changed_exercises=$(echo "$changed_files" | \
18-
grep -E '^exercises/(practice|concept)/[^/]+/.+\.(java|gradle)$' | \
25+
grep -E '^exercises/(practice|concept)/[^/]+/.+\.java$' | \
1926
cut -d/ -f1-3 | sort -u)
2027

2128
if [ -z "$changed_exercises" ]; then

0 commit comments

Comments
 (0)