Skip to content

Commit feb4dbe

Browse files
committed
ci: separate unit test and integration test
1 parent 5594e33 commit feb4dbe

File tree

1 file changed

+59
-7
lines changed

1 file changed

+59
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,25 @@ on:
99
- '**.md'
1010

1111
jobs:
12-
test:
12+
build:
13+
name: Build
1314
runs-on: ubuntu-latest
14-
permissions:
15-
contents: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Setup Java
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: 'temurin'
22+
java-version: 17
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v4
25+
- name: Build with Gradle
26+
run: ./gradlew build -x test
27+
unit-test:
28+
name: UniteTest
29+
runs-on: ubuntu-latest
30+
needs: build
1631
steps:
1732
- name: Checkout
1833
uses: actions/checkout@v4
@@ -24,12 +39,49 @@ jobs:
2439
- name: Setup Gradle
2540
uses: gradle/actions/setup-gradle@v4
2641
- name: Unit Test with Gradle
27-
run: ./gradlew :generator:test --info
42+
run: ./gradlew :generator:test
43+
- name: Upload Jacoco
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: ${{ github.job }}
47+
path: generator/build/jacoco/test.exec
48+
integration-test:
49+
strategy:
50+
matrix:
51+
middleware: [ "Tomcat", "Jetty" ]
52+
runs-on: ubuntu-latest
53+
name: ${{ matrix.middleware }}
54+
needs: [ build, unit-test ]
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@v4
58+
- name: Setup Java
59+
uses: actions/setup-java@v4
60+
with:
61+
distribution: 'temurin'
62+
java-version: 17
63+
- name: Setup Gradle
64+
uses: gradle/actions/setup-gradle@v4
2865
- name: Integration Test with gradle
29-
run: ./gradlew :integration-test:test --info
30-
continue-on-error: true
66+
run: ./gradlew :integration-test:test --tests '${{ matrix.middleware }}*'
3167
- name: Export Integration Test Summary
3268
run: cat integration-test/build/test-results/report.md >> $GITHUB_STEP_SUMMARY
69+
- name: Upload jacoco
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: ${{ matrix.middleware }}
73+
path: integration-test/build/jacoco/test.exec
74+
coverage:
75+
name: Coverage
76+
needs: [ build, unit-test, integration-test ]
77+
runs-on: ubuntu-latest
78+
permissions:
79+
contents: write
80+
steps:
81+
- name: Download Jacoco
82+
uses: actions/download-artifact@v4
83+
with:
84+
path: integration-test/build/jacoco
3385
- name: Merge Jacoco
3486
run: ./gradlew :jacocoTestReport
3587
- name: Generate JaCoCo Badge
@@ -43,7 +95,7 @@ jobs:
4395
coverage-endpoint-filename: jacoco.json
4496
generate-summary: true
4597
summary-filename: coverage-summary.json
46-
- name: Upload
98+
- name: Commit Badges
4799
uses: stefanzweifel/git-auto-commit-action@v5
48100
with:
49101
file_pattern: ".github/badges/**"

0 commit comments

Comments
 (0)