Run tests with every supported Spring Boot version #161
Workflow file for this run
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: Build Java Core Library | |
| on: | |
| pull_request: | |
| push: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| jobs: | |
| generate-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Read matrix from JSON | |
| id: set-matrix | |
| run: | | |
| MATRIX=$(jq -c '.matrix' .github/spring-versions.json) | |
| echo "matrix={\"include\":$MATRIX}" >> $GITHUB_OUTPUT | |
| regression-tests: | |
| needs: generate-matrix | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
| name: Test with Java ${{ matrix.java }} / Spring Boot ${{ matrix.boot }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: ${{ matrix.java }} | |
| - name: Run tests and generate reports | |
| run: ./gradlew testAndReport -PspringBootVersion=${{ matrix.boot }} -PspringFrameworkVersion=${{ matrix.framework }} | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: report-java-${{ matrix.java }}-spring-boot-${{ matrix.boot }} | |
| path: build/reports/** | |
| retention-days: 5 | |
| # todo kirjutada readme ka, mis põhimõttel asi toimib ning kuidas uuendada + kuidas testida erinevaid SP versioone | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: [ '17', '21' ] | |
| name: Test with latest version of Spring Boot and Java ${{ matrix.java }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: ${{ matrix.java }} | |
| - name: Run tests and generate reports | |
| run: ./gradlew testAndReport | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: report-java-${{ matrix.java }} | |
| path: build/reports/** | |
| retention-days: 5 | |
| - name: Run Sonar analysis | |
| if: matrix.java == '17' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: ./gradlew sonar -x test --no-watch-fs | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| - name: Run build with Gradle Wrapper | |
| run: ./gradlew build -x test | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jar | |
| path: build/libs/** | |
| retention-days: 5 |