Improvement over commit 0894f346564f8b31cf836def67e952fb93a6036d #228
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Tests | |
on: | |
push: | |
branches: [ "*" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
checks: write | |
actions: write | |
env: | |
OAuthToken: ${{ secrets.OAUTHTOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies. | |
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 | |
- name: Build with Gradle Wrapper | |
run: | | |
if [ "${{ github.event_name }}" == 'pull_request' ]; then | |
./gradlew build -x javadoc -Pnotoken | |
else | |
./gradlew build -x javadoc | |
fi | |
- name: Archive Test Results | |
uses: actions/upload-artifact@v2 | |
if: always() # Ensures that this step runs even if the build fails | |
with: | |
name: test-results | |
path: build/reports/tests/test | |
- name: Publish Test Report | |
uses: dorny/test-reporter@v1 | |
if: github.event_name != 'pull_request' && always() | |
with: | |
name: 'Unit Test Results' | |
path: 'build/test-results/test/TEST-*.xml' | |
reporter: 'java-junit' | |
list-tests: failed | |
fail-on-error: true |