Fixes an error in jbehave tests when they are run in a Windows os #4692
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: Build and test (using maven) | |
#on: [push, pull_request] | |
#on: [pull_request] | |
on: | |
# Trigger the workflow on push to master (ignoring .md only changes) | |
push: | |
branches: | |
- master | |
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) | |
jdk: [ 8,9,10,11,12,13,14,15,16,17,18 ] | |
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/checkout@v4.1.6 | |
with: | |
fetch-depth: "0" | |
## Setup the specified version of Java (includes maven/gradle). | |
- name: Set up JDK ${{ matrix.jdk }} | |
uses: actions/setup-java@v4 | |
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 | |
## 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 | |
## Use a cache to reduce the build/test times (avoids having to download dependencies on EVERY run). | |
### https://help.github.com/en/actions/language-and-framework-guides/building-and-testing-java-with-maven#caching-dependencies | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
## 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) | |
shell: bash | |
run: ./mvnw -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B --errors clean test --activate-profiles AlsoSlowTests | |
- name: CodeCov - JavaParser Core | |
uses: codecov/codecov-action@v4.4.1 | |
timeout-minutes: 10 | |
with: | |
files: javaparser-core-testing/target/site/jacoco/jacoco.xml,javaparser-core-testing-bdd/target/site/jacoco/jacoco.xml | |
fail_ci_if_error: false # optional (default = false) -- fail the build if upload to codecov.io fails | |
verbose: false # optional (default = false): | |
flags: javaparser-core,AlsoSlowTests,${{ matrix.os }},jdk-${{ matrix.jdk }} | |
env_vars: OS,JDK | |
- name: CodeCov - JavaParser Symbol Solver | |
uses: codecov/codecov-action@v4.4.1 | |
timeout-minutes: 10 | |
with: | |
file: javaparser-symbol-solver-testing/target/site/jacoco/jacoco.xml | |
fail_ci_if_error: false # optional (default = false) -- fail the build if upload to codecov.io fails | |
verbose: false # optional (default = false): | |
flags: javaparser-symbol-solver,AlsoSlowTests,${{ matrix.os }},jdk-${{ matrix.jdk }} | |
env_vars: OS,JDK | |
# Run checkstyle validations for pipeline | |
checkstyle_check: | |
name: Validate checkstyle | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout latest code | |
uses: actions/checkout@v4.1.6 | |
with: | |
fetch-depth: "0" | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'zulu' | |
- name: Validate Project Checkstyle | |
run: ./mvnw -B checkstyle:check |