Java CI with Maven #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Java CI with Maven | |
| on: | |
| schedule: | |
| # each fifteen day of month | |
| - cron: "0 0 15 * *" | |
| push: | |
| paths: | |
| - 'java/**' | |
| - ".github/workflows/maven.yml" | |
| pull_request: | |
| paths: | |
| - 'java/**' | |
| - ".github/workflows/maven.yml" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build with Maven (Expecting at least one test to fail) | |
| run: | | |
| cd java | |
| mvn -B test --fail-at-end || true | |
| if [ ! -d target/surefire-reports ]; then | |
| echo "Surefire reports directory not found! Failing the job." | |
| exit 1 | |
| fi | |
| if grep -q "OrderStateTest\.orderCannotBeUpdatedOrCanceledIfPaid.*FAILURE" \ | |
| target/surefire-reports/*.txt; then | |
| echo "Expected test failure detected — success as intended." | |
| else | |
| echo "Test did not fail as expected — this is a failure for this workflow." | |
| exit 1 | |
| fi | |