Skip to content

Commit a06f2b8

Browse files
feat(kap): add CI workflow
1 parent 2172c66 commit a06f2b8

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 'Check Pull Request for plugin: kafka-publish-task-plugin'
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
paths:
7+
- 'kap/**'
8+
9+
jobs:
10+
tests:
11+
name: Unit tests
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up JDK 21 for x64
16+
uses: actions/setup-java@v4
17+
with:
18+
java-version: '21'
19+
distribution: 'temurin'
20+
architecture: x64
21+
22+
- name: Start Kafka
23+
run: |
24+
docker compose -f kap/src/test/resources/docker-compose.yml up -d
25+
sleep 10
26+
27+
- name: Install Pandoc
28+
run: sudo apt-get update && sudo apt-get install -y pandoc
29+
30+
- name: Execute unit tests
31+
run: mvn -ntp -pl kap test
32+
33+
- name: Stop Kafka
34+
if: always()
35+
run: docker compose -f kap/src/test/resources/docker-compose.yml down
36+
37+
- name: Execute mutation tests
38+
run: mvn -ntp -pl kap org.pitest:pitest-maven:mutationCoverage
39+
40+
- name: Extract summary from pitest
41+
run: |
42+
echo "<html><head></head><body><h1>Pit Test Coverage Report: kafka-publish-task-plugin</h1><h3>Project Summary</h3>" > pitest.html
43+
perl -0777 -ne 'print "$1\n" if /(<table>.*?<\/table>)/s' kap/target/pit-reports/index.html >> pitest.html
44+
echo "</body></html>" >> pitest.html
45+
46+
- name: Convert pitest report to markdown
47+
run: pandoc --from html --to markdown_github --no-highlight pitest.html
48+
49+
- name: Post comment
50+
uses: luukkemp/pr-comment@2024.1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
path: pitest.html

0 commit comments

Comments
 (0)