version: 3.25.10-b3-SNAPSHOT #300
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: Tests | |
#on: [push, pull_request] | |
#on: [pull_request] | |
on: | |
# Trigger the workflow on push to master (ignoring .md only changes) | |
push: | |
branches: | |
- master | |
- devel | |
paths-ignore: | |
- '**.md' | |
# Trigger the workflow on any pull_request (ignoring .md only changes) | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
# Enable manual triggering (important for contributors to enable a check on their fork) | |
workflow_dispatch: | |
# If a build is running in the current branch, and the branch is updated, we cancel the previous build and start | |
# a new one with the updated changes. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
maven_test: | |
strategy: | |
## Optionally cancel all other combinations if one fails | |
fail-fast: false | |
matrix: | |
## Different OSs have different default line-endings -- test on all combinations. | |
os: [ ubuntu-latest , macos-latest, windows-latest ] | |
## Different JDK versions have different implementations etc. -- test on all combinations (ideally 8 to latest). | |
### exclude pre-8 (min development version jdk8) | |
### exclude post-12 (changes to jdk causes reflection tests to fail due to added methods #1701 ) | |
jdk: [ 17 ] | |
env: | |
OS: ${{ matrix.os }} | |
JDK: ${{ matrix.jdk }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
## Checkout the current version of the code from the repo. | |
- name: Checkout latest code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: "0" | |
## Setup the specified version of Java (includes maven/gradle). | |
- name: Set up JDK ${{ matrix.jdk }} | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # v2 requires explicitly stating the distribution - `zulu` and `adopt` supported at time of writing | |
java-version: ${{ matrix.jdk }} # Use matrix to select which JDK level to use | |
java-package: jdk # optional (jdk or jre) - defaults to jdk | |
cache: 'maven' | |
## Given that the build matrix only specifies the major version (configurable), output the precise version used. | |
- name: Echo exact java version being used | |
run: java -version | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
## Actually perform the tests. Unsuccessful tests will indicate a failed build. | |
### -e, --errors : show traces where any errors occur | |
### -B,--batch-mode : Run in non-interactive (batch) mode (disables output color) | |
### clean : run the maven lifecycle stage `clean` | |
### test : run the maven lifecycle stage `test` | |
### -P,--activate-profiles : Comma-delimited list of profiles to activate | |
### AlsoSlowTests : by default, only quick tests are run - the profile `AlsoSlowTests` runs the full test suite | |
- name: Test with Maven (incl. slow tests) | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: ./mvnw | |
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn | |
--activate-profiles AlsoSlowTests | |
-B --errors clean verify | |
org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | |
-Dsonar.projectKey=wadoon_jmlparser | |
- name: Test reporting | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() | |
with: | |
name: Test Report | |
path: "**/target/surefire-reports/*.xml" | |
reporter: java-junit | |
# Run checkstyle validations for pipeline | |
checkstyle_check: | |
name: Validate checkstyle | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout latest code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: "0" | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
- name: Validate Project Checkstyle | |
run: ./mvnw -B checkstyle:check |