Skip to content

feat: add GitHub actions to run tests on PR (#5) #4

feat: add GitHub actions to run tests on PR (#5)

feat: add GitHub actions to run tests on PR (#5) #4

Workflow file for this run

name: X-Road-Catalog tests
on:
# Capture this event so that gradle caches are updated when a PR is merged to develop
# More information on why: https://github.com/gradle/gradle-build-action#using-the-caches-read-only
push:
branches:
- develop
paths:
- 'xroad-catalog-collector/src/**'
- 'xroad-catalog-lister/src/**'
- 'xroad-catalog-persistence/src/**'
- '.github/**'
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'xroad-catalog-collector/src/**'
- 'xroad-catalog-lister/src/**'
- 'xroad-catalog-persistence/src/**'
- '.github/**'
jobs:
Test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
with:
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
gradle-home-cache-cleanup: true
- name: Run tests
run: ./gradlew test
- name: Test report
env:
NODE_OPTIONS: '--max-old-space-size=6144'
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test results
path: ./**/build/test-results/**/TEST-*.xml
reporter: java-junit
list-suites: 'failed'
list-tests: 'failed'