-
Notifications
You must be signed in to change notification settings - Fork 23
81 lines (72 loc) · 3.08 KB
/
build-and-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Build and Test
on:
workflow_call:
inputs:
runs-on:
description: Platform to execute on
type: string
default: macos-latest
secrets:
SLACK_WEBHOOK:
description: Slack Notifier Incoming Webhook
required: true
CODECOV_TOKEN:
description: Codecov token
required: true
jobs:
build-and-test:
runs-on: ${{ inputs.runs-on }}
steps:
# Clone the repo
- name: Clone the repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
# Setup JDK and cache and restore dependencies.
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
# Execute forgerock-core debug unit tests with coverage report
- name: Run forgerock-core debug unit tests
run: ./gradlew :forgerock-core:testDebugUnitTestCoverage --stacktrace --no-daemon
# Execute forgerock-auth debug unit tests with coverage report
- name: Run forgerock-auth debug unit tests
run: ./gradlew :forgerock-auth:testDebugUnitTestCoverage --stacktrace --no-daemon
# Execute forgerock-authenticator debug unit tests with coverage report
- name: Run forgerock-authenticator debug unit tests
run: ./gradlew :forgerock-authenticator:testDebugUnitTestCoverage --stacktrace --no-daemon
# Execute forgerock-authenticator debug unit tests with coverage report
- name: Run ping-protect debug unit tests
run: ./gradlew :ping-protect:testDebugUnitTestCoverage --stacktrace --no-daemon
# Publish test reports for the unit tests
- name: Publish test results
if: success() || failure()
uses: dorny/test-reporter@v1
with:
name: Unit tests results
path: 'forgerock-core/build/test-results/**/TEST-*.xml,forgerock-auth/build/test-results/**/TEST-*.xml,forgerock-authenticator/build/test-results/**/TEST-*.xml,ping-protect/build/test-results/**/TEST-*.xml'
list-suites: 'all'
list-tests: 'all'
fail-on-error: 'true'
reporter: java-junit
# Upload coverage reports to Codecov
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: forgerock-core/build/coverage-report/test-coverage.xml, forgerock-auth/build/coverage-report/test-coverage.xml, forgerock-authenticator/build/coverage-report/test-coverage.xml, ping-protect/build/coverage-report/test-coverage.xml
flags: unit-tests
- uses: 8398a7/action-slack@v3
with:
mention: 'stoyan.petrov,andy.witrisna,jey.periyasamy'
if_mention: 'failure,cancelled'
fields: repo,author,eventName,message,job,pullRequest,took
status: ${{ job.status }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
if: always()