-
Notifications
You must be signed in to change notification settings - Fork 140
221 lines (202 loc) · 8.31 KB
/
Copy pathci.yml
File metadata and controls
221 lines (202 loc) · 8.31 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: CI
on:
push:
branches: [development]
pull_request:
branches: [development]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Build and Test
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v6
with:
java-version: '25'
distribution: temurin
cache: maven
- name: Build, unit tests, integration tests and coverage
run: mvn -B clean verify --file pom.xml --no-transfer-progress
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/site/jacoco/jacoco.xml
fail_ci_if_error: ${{ github.actor != 'dependabot[bot]' }}
- name: SonarCloud analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mvn -B sonar:sonar \
-Dsonar.projectKey=Sunagatov_Iced-Latte \
-Dsonar.organization=zufar \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \
--no-transfer-progress
- name: Notify Telegram on success
if: success()
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
BRANCH: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
MSG: ${{ github.event.pull_request.title || github.event.head_commit.message }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
curl -s -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage \
-d chat_id=${CHAT_ID} \
-d text="[OK] CI: Build/Test passed%0ARepo: ${REPO}%0ABranch: ${BRANCH}%0ASha: ${SHA:0:7}%0ABy: ${ACTOR}%0AMsg: ${MSG}%0A${RUN_URL}"
- name: Notify Telegram on failure
if: failure()
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
BRANCH: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
MSG: ${{ github.event.pull_request.title || github.event.head_commit.message }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
curl -s -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage \
-d chat_id=${CHAT_ID} \
-d text="[FAIL] CI: Build/Test failed%0ARepo: ${REPO}%0ABranch: ${BRANCH}%0ASha: ${SHA:0:7}%0ABy: ${ACTOR}%0AMsg: ${MSG}%0A${RUN_URL}"
owasp:
name: OWASP Dependency Check
runs-on: ubuntu-latest
permissions:
contents: read
timeout-minutes: 45
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v6
with:
java-version: '25'
distribution: temurin
cache: maven
- name: Run OWASP Dependency-Check
id: owasp
env:
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
run: |
mvn -B org.owasp:dependency-check-maven:check \
-DfailBuildOnCVSS=7 \
-DsuppressionFile=.github/owasp-suppressions.xml \
-DnvdApiKey=${NVD_API_KEY} \
--no-transfer-progress
echo "status=clean" >> $GITHUB_OUTPUT
- name: Notify Telegram on success
if: success()
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
BRANCH: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
MSG: ${{ github.event.pull_request.title || github.event.head_commit.message }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
curl -s -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage \
-d chat_id=${CHAT_ID} \
-d text="[OK] OWASP: No vulnerabilities found%0ARepo: ${REPO}%0ABranch: ${BRANCH}%0ASha: ${SHA:0:7}%0ABy: ${ACTOR}%0AMsg: ${MSG}%0A${RUN_URL}"
- name: Notify Telegram on failure
if: failure()
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
BRANCH: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
MSG: ${{ github.event.pull_request.title || github.event.head_commit.message }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
curl -s -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage \
-d chat_id=${CHAT_ID} \
-d text="[ALERT] OWASP check failed%0ARepo: ${REPO}%0ABranch: ${BRANCH}%0ASha: ${SHA:0:7}%0ABy: ${ACTOR}%0AMsg: ${MSG}%0A${RUN_URL}"
- name: Upload report
if: always()
uses: actions/upload-artifact@v7
with:
name: owasp-report
path: target/dependency-check-report.html
openapi-diff:
name: OpenAPI Breaking Change Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for breaking changes in API specs
env:
EVENT_NAME: ${{ github.event_name }}
BASE_REF: ${{ github.base_ref }}
OASDIFF_IMAGE: tufin/oasdiff:v1.11.8
run: |
if [ "${EVENT_NAME}" = "pull_request" ]; then
REF="origin/${BASE_REF}"
else
REF="HEAD~1"
fi
BREAKING=0
BASE_DIR=.api-specs-base
mkdir -p "$BASE_DIR"
for f in src/main/resources/api-specs/*.yaml; do
name=$(basename "$f")
git show ${REF}:"$f" > "$BASE_DIR/$name" 2>/dev/null || true
done
for spec in src/main/resources/api-specs/*-openapi.yaml; do
name=$(basename "$spec")
[ -f "$BASE_DIR/$name" ] || continue
if docker run --rm -v "$PWD:/work" -w /work "$OASDIFF_IMAGE" breaking "$BASE_DIR/$name" "$spec" --fail-on ERR; then
echo "[OK] No breaking changes in $name"
else
echo "[FAIL] Breaking changes detected in $name"
BREAKING=1
fi
done
exit $BREAKING
- name: Notify Telegram on success
if: success()
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
BRANCH: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
MSG: ${{ github.event.pull_request.title || github.event.head_commit.message }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
curl -s -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage \
-d chat_id=${CHAT_ID} \
-d text="[OK] CI: No breaking API changes%0ARepo: ${REPO}%0ABranch: ${BRANCH}%0ASha: ${SHA:0:7}%0ABy: ${ACTOR}%0AMsg: ${MSG}%0A${RUN_URL}"
- name: Notify Telegram on failure
if: failure()
env:
BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
BRANCH: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
SHA: ${{ github.sha }}
REPO: ${{ github.repository }}
MSG: ${{ github.event.pull_request.title || github.event.head_commit.message }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
curl -s -X POST https://api.telegram.org/bot${BOT_TOKEN}/sendMessage \
-d chat_id=${CHAT_ID} \
-d text="[FAIL] CI: Breaking API change detected%0ARepo: ${REPO}%0ABranch: ${BRANCH}%0ASha: ${SHA:0:7}%0ABy: ${ACTOR}%0AMsg: ${MSG}%0A${RUN_URL}"