-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (106 loc) · 4.38 KB
/
Copy pathcontinuous-integration.yml
File metadata and controls
121 lines (106 loc) · 4.38 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
name: Continuous Integration
on:
workflow_call:
inputs:
timeoutMinutes:
required: false
type: number
default: 10
# expected value is a JSON String. Example: '{"jdk": [11,17]}'
matrix:
required: true
type: string
javaDistribution:
description: 'The Java distribution to use. (defaults to eclipse "temurin")'
required: false
type: string
default: 'temurin'
skipTests:
required: false
type: boolean
default: false
mattermostChannel:
required: false
type: string
default: 'ci_qm_test'
notifyMattermost:
required: false
type: boolean
default: true
multiModule:
description: Whether the project is a multi-module build. Determines whether the aggregate maven goal will be used.
required: false
type: boolean
default: false
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: ${{ inputs.timeoutMinutes}}
env:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
# `showDateTime` will show the passed time in milliseconds. You need to specify `--batch-mode` to make this work.
MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd` are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true"
strategy:
fail-fast: false
matrix: ${{ fromJSON(inputs.matrix) }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up JDK
uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5.2.0 v5
with:
distribution: ${{ inputs.javaDistribution }}
java-version: ${{ matrix.jdk }}
cache: 'maven'
##
## Starting here, there are 4 branches in the workflow
##
## 1. Maven Build without running Tests
- name: Perform build
if: ${{ inputs.skipTests == true }}
run: mvn $MAVEN_CLI_OPTS verify -DskipTests
## 2. Maven Build and run Tests
- name: Perform build
if: ${{ inputs.skipTests == false }}
run: mvn $MAVEN_CLI_OPTS verify -Dmaven.test.failure.ignore=true
## run in case 2.
- name: Publish Test Report
if: inputs.skipTests == false
uses: ScalableCapital/action-surefire-report@3b3f3f1178bc72d43fe062d5eb7fc316ee1663eb # v2.0.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_test_failures: true
fail_if_no_tests: true
- name: Notify developers
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
if: inputs.notifyMattermost && always()
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
channel: ${{ inputs.mattermostChannel }}
username: "GitHub"
text: ${{ github.workflow }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
attachments:
- color: "${{ job.status == 'success' && 'good' || job.status == 'failure' && 'danger' || 'warning' }}"
fields:
- title: "Repository"
value: "${{ github.repository }}"
short: true
- title: "Run"
value: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>"
short: true
- title: "Author"
value: "${{ github.actor }}"
short: true
- title: "Status"
value: "${{ job.status }}"
short: true
call-license-check:
uses: ./.github/workflows/license-check.yml
secrets: inherit
with:
multiModule: ${{ inputs.multiModule }}