Ci: Run different jobs on push or mr

This commit is contained in:
Lars Simon Winzer
2026-03-14 09:33:55 +01:00
parent 000a5c0d9a
commit 39b6c5e13e
+37 -5
View File
@@ -11,9 +11,38 @@ stages:
- .gradle/
- ~/.gradle/caches/
.on-commit: &on-commit
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: '$CI_COMMIT_BRANCH'
allow_failure: true
.on-mr: &on-mr
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
allow_failure: true # deactivate after all issues (shown by checkstyle) have been resolved
# Jobs
checkstyle:
<<: *gradle-cache
<<: [*gradle-cache, *on-commit]
stage: lint
image: gradle:9.3.1-jdk25
script:
- gradle checkstyleMain checkstyleTest
allow_failure: true
artifacts:
when: always
paths:
- build/reports/checkstyle/main.html
- build/reports/checkstyle/main.xml
- build/reports/checkstyle/test.html
- build/reports/checkstyle/test.xml
expose_as: 'Checkstyle Report'
expire_in: 1 week
checkstyle-mr:
<<: [*gradle-cache, *on-mr]
stage: lint
image: gradle:9.3.1-jdk25
script:
@@ -28,16 +57,16 @@ checkstyle:
- build/reports/checkstyle/test.xml
expose_as: 'Checkstyle Report'
expire_in: 1 week
rules:
- when: manual
checkstyle-report:
stage: report
image: python:3.14
needs:
- job: checkstyle
- job: checkstyle-mr
artifacts: true
optional: true
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
script:
- python3 scripts/convert-checkstyle-gl-report.py
artifacts:
@@ -54,4 +83,7 @@ compile-check:
- gradle compileTestJava
needs: []
rules:
- when: manual
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
allow_failure: false
- if: '$CI_COMMIT_BRANCH'
allow_failure: false