Merge commit from fork #1137
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: | |
# From https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions#example-returning-a-json-object | |
build-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- id: set-matrix | |
run: | | |
echo "matrix={ \"os\": [\"windows-2022\", \"macOS-latest\", \"ubuntu-latest\"], \"java_version\": [17] }" >> $GITHUB_OUTPUT | |
build: | |
name: Build / JDK ${{ matrix.java_version }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: build-matrix | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
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' | |
- 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 | |
test-gradle-plugin: | |
name: Test / Gradle / JDK ${{ matrix.java_version }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build-matrix | |
- build | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
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' | |
- uses: ./.github/gradle-cache | |
with: | |
key: "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 -DskipTests=true | |
- 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/**/* | |
- uses: ./.github/prepare-cache-action | |
test-graal: | |
name: Test / Graal / JDK ${{ matrix.java_version }} / ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: | |
- build-matrix | |
- build | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: 'graalvm' | |
java-version: ${{ matrix.java_version }} | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cache: 'maven' | |
- uses: ./.github/gradle-cache | |
with: | |
key: "gradle-graalvm" | |
- 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 -DskipTests=true | |
- name: Build Gradle Plugin | |
run: cd jte-gradle-plugin && ./gradlew publishToMavenLocal | |
- name: Test Gradle Plugin Generate with conventions | |
run: cd test/jte-runtime-cp-test-gradle-convention && ./gradlew check nativeTest | |
- name: Stop Gradle Daemon | |
if: ${{ always() }} | |
run: cd test/jte-runtime-cp-test-gradle-convention && ./gradlew --stop | |
- uses: ./.github/prepare-cache-action | |
test-kotlin: | |
name: Test / Kotlin / ${{ matrix.kotlin-profile }} | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
kotlin-profile: ["kotlin-1.9", "kotlin-2.0"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
cache: 'maven' | |
- name: Make Maven Wrapper executable | |
run: chmod +x ./mvnw | |
- name: Build with Maven | |
run: ./mvnw install --file pom.xml -DskipTests=true | |
- name: Test Kotlin Profile ${{ matrix.kotlin-profile }} | |
run: ./mvnw test --file pom.xml --projects jte-kotlin --also-make --activate-profiles ${{ matrix.kotlin-profile }} | |
- uses: ./.github/prepare-cache-action | |
coverage: | |
name: Test / 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 | |
needs: | |
- test-gradle-plugin | |
- test-kotlin | |
- test-graal | |
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,kotlin-1.9 | |
- 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 |