Add spring-boot-starter dependency to pom.xml #13
This file contains 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: Test all JDKs on all OSes | |
# No need to run when only the docs are changing. There is | |
# a workflow to validate the docs. | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore | |
on: | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- 'mkdocs.yml' | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
java_version: [17] | |
os: [windows-2022, macOS-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK ${{ matrix.java_version }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java_version }} | |
distribution: 'temurin' | |
cache: 'maven' | |
# Adapted from https://github.com/actions/cache/blob/v3/examples.md#java---gradle | |
- name: Cache local Gradle | |
id: gradleCache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Make Maven Wrapper executable | |
if: contains(matrix.os, 'win') == false | |
run: chmod +x ./mvnw | |
- name: Build with Maven | |
run: ./mvnw install --file pom.xml | |
- name: Build Gradle Plugin | |
run: cd jte-gradle-plugin && ./gradlew publishToMavenLocal | |
- name: Run all the Gradle Plugin tests | |
id: gradlePluginTests | |
run: cd test/gradle-test-wrapper && ./gradlew --info check | |
- name: Stop Gradle Daemon | |
if: ${{ always() }} | |
run: cd test/gradle-test-wrapper && ./gradlew --stop | |
- name: Store Gradle plugin test reports | |
if: failure() && steps.gradlePluginTests.outcome == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: failing-test-report | |
path: test/gradle-test-wrapper/build/reports/tests/test/**/* | |
# This prevents local published artifacts from be added to GH Actions cache | |
- name: Clean local artifacts | |
if: contains(matrix.os, 'win') == false | |
run: rm -rvf ~/.m2/repository/gg/jte | |
# `rm` syntax for Windows is different. Needs to use `-Force` since `-f` | |
# is ambiguous (possible matches include: -Filter -Force). | |
- name: "[Windows]: Clean local artifacts" | |
if: contains(matrix.os, 'win') | |
run: rm -r -Force ~/.m2/repository/gg/jte | |
coverage: | |
# Do not run coverage for forks since they cannot upload | |
# the results to codecov. For reference, see: | |
# https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#example-only-run-job-for-specific-repository | |
if: github.repository == 'casid/jte' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Make Maven Wrapper executable | |
if: contains(matrix.os, 'win') == false | |
run: chmod +x ./mvnw | |
- name: Build with Maven | |
run: ./mvnw verify --file pom.xml -Pcoverage | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: ./test/jte-test-report/target/site/jacoco-aggregate/jacoco.xml | |
fail_ci_if_error: true |