-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (114 loc) · 3.85 KB
/
CI.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
delete-comments:
name: Delete bot comment(s)
runs-on: ubuntu-latest
steps:
- uses: izhangzhihao/delete-comment@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_user_name: github-actions[bot]
issue_number: ${{ github.event.number }}
branch-naming-rules:
name: Check branch name
runs-on: ubuntu-latest
steps:
- uses: deepakputhraya/action-branch-name@master
with:
regex: '^(feature|bugfix|improvement|library|prerelease|release|hotfix)\/[a-z0-9_.-]+$'
allowed_prefixes: 'feature,bugfix,improvement,library,prerelease,release,hotfix'
ignore: main
min_length: 5
max_length: 50
checkstyle:
name: Code style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
architecture: x64
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute checkstyle
run: ./gradlew checkstyleMain
tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21 for x64
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
architecture: x64
- name: Install Pandoc
run: sudo apt-get update && sudo apt-get install -y pandoc
- name: Generate certificate
run: |
keytool \
-genkeypair -v \
-alias mykey \
-dname "CN=Test, OU=Test, O=Test, L=Test, S=Test, C=Test" \
-keystore src/main/resources/keystore.jks \
-storepass password \
-keypass password \
-keyalg RSA \
-keysize 2048 \
-validity 3650
- name: Build application
run: docker build -t leto-modelizer-api .
- name: Run application
run: docker compose -f docker-compose-e2e.yml up -d
env:
GITHUB_CLIENT_ID: test
GITHUB_CLIENT_SECRET: test
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute unit/e2e tests
run: ./gradlew test
- name: Execute mutation tests
run: ./gradlew pitest
- name: Extract summary from pitest
run: echo "<html><head></head><body><h1>Pit Test Coverage Report</h1><h3>Project Summary</h3>" > pitest.html && perl -0777 -ne 'print "$1\n" if /(<table>.*?<\/table>)/s' build/reports/pitest/index.html >> pitest.html && echo "</body></html>" >> pitest.html
- name: Convert pitest report to markdown
run: pandoc --from html --to markdown_github --no-highlight pitest.html
- name: Post comment
uses: luukkemp/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: pitest.html
- name: Execute sonar scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar -Dsonar.token=$SONAR_TOKEN -Dsonar.gradle.skipCompile=true
check-dependencies:
name: Check dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
architecture: x64
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute check dependencies
run: ./gradlew dependencyUpdates
- name: Post comment
uses: luukkemp/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: build/dependencyUpdates/report.txt