-
Notifications
You must be signed in to change notification settings - Fork 3
38 lines (34 loc) · 967 Bytes
/
main.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
name: Java CI with Maven
on:
push:
branches: [ "master" ] # 触发分支
pull_request:
branches: [ "master" ] # 触发分支
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin' # 选择一个Java发行版
cache: maven # 缓存m2仓库以加速构建
- name: Build with Maven
run: mvn -B clean package --file pom.xml
- name: Run JUnit tests
run: mvn -B verify --file pom.xml
- name: Collect Test Results
run: |
mkdir -p ./test-results
for d in $(find . -type d -name "surefire-reports"); do
cp $d/*.xml ./test-results/
done
shell: bash
- name: Archive test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: spec/target/surefire-reports/