Skip to content

Commit 60fe52c

Browse files
authored
Merge pull request #12 from turing85/main
#10 Pipeline updates and improvements
2 parents fef261e + 9291e28 commit 60fe52c

File tree

7 files changed

+364
-171
lines changed

7 files changed

+364
-171
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ---------------------------------------------------------------------------
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ---------------------------------------------------------------------------
17+
18+
name: Read environment
19+
20+
description: |
21+
Reads the file .github/workflows/.env and registers all entries in ${GITHUB_ENV}
22+
23+
runs:
24+
using: composite
25+
26+
steps:
27+
- name: read-env
28+
shell: bash
29+
run: cat .github/workflows/.env >> ${GITHUB_ENV}

.github/workflows/.env

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
JAR_ARTIFACT_NAME=jars
2+
3+
JAVA_DISTRIBUTION=temurin
4+
JAVA_VERSION=17
5+
6+
PR_NUMBER_ARTIFACT_NAME=pr-number
7+
8+
TEST_REPORTS_ARTIFACT_NAME=test-reports
9+
TEST_REPORTS_NAME=Citrus Tests

.github/workflows/build.yml

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
# ---------------------------------------------------------------------------
1717

18-
name: build
18+
name: Build
1919

2020
on:
2121
pull_request:
@@ -36,28 +36,80 @@ on:
3636
- 'KEYS'
3737
- 'LICENSE'
3838
- 'NOTICE'
39+
env:
40+
JAVA_DISTRIBUTION: will-be-read-from-env-file
41+
JAVA_VERSION: will-be-read-from-env-file
42+
JAR_ARTIFACT_NAME: will-be-read-from-env-file
43+
TEST_REPORTS_ARTIFACT_NAME: will-be-read-from-env-file
44+
PR_NUMBER_ARTIFACT_NAME: will-be-read-from-env-file
45+
46+
permissions:
47+
actions: write
48+
checks: write
49+
pull-requests: write
3950

4051
jobs:
4152
build:
42-
runs-on: ubuntu-20.04
53+
runs-on: ubuntu-latest
4354

4455
steps:
45-
- name: Set up JDK 17
46-
uses: AdoptOpenJDK/install-jdk@v1
47-
with:
48-
version: '17'
4956
- name: Checkout code
50-
uses: actions/checkout@v2
51-
- name: Cache Maven packages
52-
uses: actions/cache@v2
57+
uses: actions/checkout@v4
58+
59+
- name: Setup environment variables
60+
uses: ./.github/actions/setup-env
61+
62+
- name: Set up JDK ${{ env.JAVA_DISTRIBUTION}} ${{ env.JAVA_VERSION }}
63+
uses: actions/setup-java@v4
5364
with:
54-
path: ~/.m2
55-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
56-
restore-keys: ${{ runner.os }}-m2
65+
cache: 'maven'
66+
distribution: ${{ env.JAVA_DISTRIBUTION }}
67+
java-version: ${{ env.JAVA_VERSION }}
68+
5769
- name: Info
5870
run: |
5971
java -version
60-
mvn -version
72+
./mvnw -version
73+
docker --version
74+
6175
- name: Build
6276
run: |
63-
mvn --no-transfer-progress install
77+
./mvnw \
78+
--activate-profiles docker,skip-docker-stop \
79+
--batch-mode \
80+
--no-transfer-progress \
81+
verify
82+
83+
- name: Upload JARs
84+
uses: actions/upload-artifact@v4
85+
if: ${{ always() }}
86+
with:
87+
if-no-files-found: error
88+
name: ${{ env.JAR_ARTIFACT_NAME }}
89+
path: |
90+
**/*.jar
91+
retention-days: 2
92+
93+
- name: Upload test report
94+
uses: actions/upload-artifact@v4
95+
if: ${{ always() }}
96+
with:
97+
if-no-files-found: error
98+
name: ${{ env.TEST_REPORTS_ARTIFACT_NAME }}
99+
path: |
100+
**/target/failsafe-reports/TEST*.xml
101+
**/target/citrus-remote/junitreports/TEST*.xml
102+
retention-days: 2
103+
104+
- name: Get PR number
105+
id: get-pr-number
106+
if: ${{ always() && github.event_name == 'pull_request' }}
107+
run: |
108+
echo "${{ github.event.number }}" > "pr-number.txt"
109+
110+
- name: Upload PR number
111+
uses: actions/upload-artifact@v4
112+
if: ${{ always() && github.event_name == 'pull_request' }}
113+
with:
114+
name: ${{ env.PR_NUMBER_ARTIFACT_NAME }}
115+
path: pr-number.txt

.github/workflows/pr-comment.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# ---------------------------------------------------------------------------
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ---------------------------------------------------------------------------
17+
18+
name: Comment on PR
19+
20+
on:
21+
pull_request_target:
22+
branches:
23+
- main
24+
paths-ignore:
25+
- '**.adoc'
26+
- '**.md'
27+
- 'KEYS'
28+
- 'LICENSE'
29+
- 'NOTICE'
30+
31+
permissions:
32+
pull-requests: write
33+
34+
jobs:
35+
comment:
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: (Re)create comment
40+
uses: turing85/publish-report@v2
41+
with:
42+
github-token: ${{ github.token }}
43+
comment-message-recreate: |
44+
## 🚦Reports 🚦
45+
Reports will be posted here as they get available.
46+
comment-message-pr-number: ${{ github.event.number }}
47+
recreate-comment: true

.github/workflows/pr-report.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# ---------------------------------------------------------------------------
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ---------------------------------------------------------------------------
17+
18+
name: Build report
19+
20+
on:
21+
workflow_run:
22+
workflows:
23+
- "build"
24+
types:
25+
- completed
26+
27+
permissions:
28+
actions: write
29+
checks: write
30+
pull-requests: write
31+
32+
env:
33+
TEST_REPORTS_ARTIFACT_NAME: will-be-read-from-env-file
34+
PR_NUMBER_ARTIFACT_NAME: will-be-read-from-env-file
35+
TEST_REPORTS_NAME: will-be-read-from-env-file
36+
37+
jobs:
38+
report:
39+
if: ${{ github.event.workflow_run.event == 'pull_request' }}
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
46+
- name: Setup environment variables
47+
uses: ./.github/actions/setup-env
48+
49+
- name: Download ${{ env.PR_NUMBER_ARTIFACT_NAME }}
50+
uses: actions/download-artifact@v4
51+
with:
52+
github-token: ${{ github.token }}
53+
name: ${{ env.PR_NUMBER_ARTIFACT_NAME }}
54+
run-id: ${{ github.event.workflow_run.id }}
55+
56+
- name: Set PR number
57+
id: set-pr-number
58+
run: |
59+
echo "pr-number=$(cat pr-number.txt)" >> "${GITHUB_OUTPUT}"
60+
rm -rf pr-number.txt
61+
62+
- name: Publish reports
63+
uses: turing85/publish-report@v2
64+
with:
65+
comment-message-pr-number: ${{ steps.set-pr-number.outputs.pr-number }}
66+
download-artifact-name: ${{ env.TEST_REPORTS_ARTIFACT_NAME }}
67+
download-artifact-run-id: ${{ github.event.workflow_run.id }}
68+
report-name: ${{ env.TEST_REPORTS_NAME }}
69+
report-path: '**/target/**/TEST*.xml'

0 commit comments

Comments
 (0)