Skip to content

Commit bf59c62

Browse files
committed
ChatGPT improved workflows
1 parent 34e9fa8 commit bf59c62

2 files changed

Lines changed: 55 additions & 4 deletions

File tree

‎.github/workflows/branch-build-and-publish.yml‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
--non-recursive org.codehaus.mojo:exec-maven-plugin:3.5.1:exec)
3939
if [[ "$BASE_VER" != *-SNAPSHOT ]]; then
4040
echo "Branch workflow skipped: version '$BASE_VER' is not a SNAPSHOT"
41+
echo "new_version=" >> $GITHUB_OUTPUT
4142
exit 0
4243
fi
4344
# Replace -SNAPSHOT with -SHORT_SHA-RUN_ATTEMPT
@@ -46,10 +47,30 @@ jobs:
4647
echo "new_version=${NEW_VER}" >> $GITHUB_OUTPUT
4748
echo "Using ${NEW_VER}"
4849
50+
tests:
51+
name: Tests
52+
runs-on: ubuntu-latest
53+
needs: prepare
54+
if: ${{ needs.prepare.outputs.new_version != '' }}
55+
steps:
56+
- uses: actions/checkout@v4.1.1
57+
- uses: actions/setup-java@v4.0.0
58+
with:
59+
distribution: ${{ env.JAVA_DISTRIBUTION }}
60+
java-version: ${{ env.JAVA_VERSION }}
61+
cache: maven
62+
- name: Set version
63+
run: mvn -q -DnewVersion="${{ needs.prepare.outputs.new_version }}" -DgenerateBackupPoms=false versions:set
64+
- name: Run reactor tests
65+
run: |
66+
mvn -B -pl '!modules/agent' test
67+
mvn -B -pl modules/agent -DskipNativeBuild=true test
68+
4969
macos:
5070
name: macOS (x86_64 + arm64)
5171
runs-on: macos-14
5272
needs: prepare
73+
if: ${{ needs.prepare.outputs.new_version != '' }}
5374
steps:
5475
- uses: actions/checkout@v4.1.1
5576
- uses: actions/setup-java@v4.0.0
@@ -78,6 +99,7 @@ jobs:
7899
name: Linux (x86_32 + x86_64 + aarch64 cross)
79100
runs-on: ubuntu-22.04
80101
needs: prepare
102+
if: ${{ needs.prepare.outputs.new_version != '' }}
81103
steps:
82104
- uses: actions/checkout@v4.1.1
83105
- uses: actions/setup-java@v4.0.0
@@ -147,6 +169,7 @@ jobs:
147169
name: Windows (x86 + x64)
148170
runs-on: windows-latest
149171
needs: prepare
172+
if: ${{ needs.prepare.outputs.new_version != '' }}
150173
steps:
151174
- uses: actions/checkout@v4.1.1
152175
- uses: actions/setup-java@v4.0.0
@@ -174,7 +197,8 @@ jobs:
174197

175198
deploy-reactor:
176199
name: Deploy non-agent modules
177-
needs: [prepare, macos, linux-x, windows-x86]
200+
needs: [prepare, tests, macos, linux-x, windows-x86]
201+
if: ${{ github.event_name == 'push' && needs.prepare.outputs.new_version != '' }}
178202
runs-on: ubuntu-latest
179203
steps:
180204
- uses: actions/checkout@v4.1.1
@@ -210,7 +234,8 @@ jobs:
210234
211235
publish-agent-classifiers:
212236
name: Publish agent POM + native classifiers
213-
needs: [prepare, macos, linux-x, windows-x86, deploy-reactor]
237+
needs: [prepare, tests, macos, linux-x, windows-x86, deploy-reactor]
238+
if: ${{ github.event_name == 'push' && needs.prepare.outputs.new_version != '' }}
214239
runs-on: ubuntu-latest
215240
steps:
216241
- uses: actions/checkout@v4.1.1
@@ -277,6 +302,11 @@ jobs:
277302
CLASSIFIERS=""
278303
TYPES=""
279304
305+
if [ -z "$CLASSIFIER_JARS" ]; then
306+
echo "Error: no classifier JARs found to publish"
307+
exit 1
308+
fi
309+
280310
if [ -n "$CLASSIFIER_JARS" ]; then
281311
echo "Found classifier JARs:"
282312
echo "$CLASSIFIER_JARS"

‎.github/workflows/main-publish-pom-version.yml‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ jobs:
3737
echo "version=${VER}" >> $GITHUB_OUTPUT
3838
echo "Publishing version ${VER}"
3939
40+
tests:
41+
name: Tests
42+
runs-on: ubuntu-latest
43+
needs: prepare
44+
steps:
45+
- uses: actions/checkout@v4.1.1
46+
- uses: actions/setup-java@v4.0.0
47+
with:
48+
distribution: ${{ env.JAVA_DISTRIBUTION }}
49+
java-version: ${{ env.JAVA_VERSION }}
50+
cache: maven
51+
- name: Run reactor tests
52+
run: |
53+
mvn -B -pl '!modules/agent' test
54+
mvn -B -pl modules/agent -DskipNativeBuild=true test
55+
4056
macos:
4157
name: macOS (x86_64 + arm64)
4258
runs-on: macos-14
@@ -158,7 +174,7 @@ jobs:
158174

159175
deploy-reactor:
160176
name: Deploy non-agent modules
161-
needs: [prepare, macos, linux-x, windows-x86]
177+
needs: [prepare, tests, macos, linux-x, windows-x86]
162178
runs-on: ubuntu-latest
163179
steps:
164180
- uses: actions/checkout@v4.1.1
@@ -194,7 +210,7 @@ jobs:
194210
195211
publish-agent-classifiers:
196212
name: Publish agent POM + native classifiers
197-
needs: [prepare, macos, linux-x, windows-x86, deploy-reactor]
213+
needs: [prepare, tests, macos, linux-x, windows-x86, deploy-reactor]
198214
runs-on: ubuntu-latest
199215
steps:
200216
- uses: actions/checkout@v4.1.1
@@ -258,6 +274,11 @@ jobs:
258274
CLASSIFIERS=""
259275
TYPES=""
260276
277+
if [ -z "$CLASSIFIER_JARS" ]; then
278+
echo "Error: no classifier JARs found to publish"
279+
exit 1
280+
fi
281+
261282
if [ -n "$CLASSIFIER_JARS" ]; then
262283
echo "Found classifier JARs:"
263284
echo "$CLASSIFIER_JARS"

0 commit comments

Comments
 (0)