-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (69 loc) · 2.24 KB
/
test.yml
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
name: Run Tests
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
permissions:
contents: read
env:
JAVA_VERSION: "21"
DISTRIBUTION: "corretto"
jobs:
test:
strategy:
matrix:
include:
- type: jvm
build_args: ""
- type: native
build_args: "-Dnative"
name: Run ${{ matrix.type }} Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Cache Maven Dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.DISTRIBUTION }}
cache: maven
- name: Generate Development Key Pair
run: |
mkdir -p src/main/resources
openssl genpkey -algorithm RSA -out src/main/resources/dev-private-key.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -in src/main/resources/dev-private-key.pem -pubout -out src/main/resources/dev-public-key.pem
- name: Run Tests
run: mvn clean test ${{ matrix.build_args }}
- name: Output Test Results
if: always()
run: |
echo "${{ matrix.type }} Test Results:" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
if [[ -f "target/surefire-reports/TEST-*.xml" ]]; then
mvn surefire-report:report-only -DshowSuccess=true | awk '
BEGIN { inTestSection = 0; }
/-------------------------------------------------------/ {
if (inTestSection) {
print ""; # Add blank line after each test section
}
inTestSection = 1;
print; # Print the test section header
}
inTestSection { print; } # Print test results within a section
' >> $GITHUB_STEP_SUMMARY
else
echo "No test results found." >> $GITHUB_STEP_SUMMARY
fi
echo "```" >> $GITHUB_STEP_SUMMARY