-
Notifications
You must be signed in to change notification settings - Fork 22
182 lines (158 loc) · 8.01 KB
/
build.yml
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
name: "Build"
on:
push:
branches:
- "*"
pull_request:
workflow_dispatch:
inputs:
examplesRepo:
description: '(For non-main Examples) Artemis repo'
required: true
default: 'apache/activemq-artemis'
type: string
examplesRepoBranch:
description: '(For non-main Examples) Artemis branch'
required: true
default: 'main'
type: string
env:
ARTEMIS_REPO: ${{ inputs.examplesRepo || 'apache/activemq-artemis' }}
ARTEMIS_BRANCH: ${{ inputs.examplesRepoBranch || 'main' }}
jobs:
test:
name: Verify Examples
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
java: [ 11 ]
steps:
- uses: actions/checkout@v4
with:
path: activemq-artemis-examples
- name: Cache Maven Local Repo
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@v4
with:
path: |
~/.m2/repository/
key: ${{ runner.os }}-mvn-${{ hashFiles('activemq-artemis-examples/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-
- name: Install JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Checkout Artemis Repo (non-main Examples)
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
uses: actions/checkout@v4
with:
repository: ${{ env.ARTEMIS_REPO }}
ref: ${{ env.ARTEMIS_BRANCH }}
path: activemq-artemis
- name: Identify Artemis Version (non-main Examples)
id: identify-artemis-version
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
run: |
cd activemq-artemis
CURRENT_ARTEMIS_BUILD_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Current Artemis version: ${CURRENT_ARTEMIS_BUILD_VERSION}"
echo "artemis-build-version=${CURRENT_ARTEMIS_BUILD_VERSION}" >> $GITHUB_OUTPUT
- name: Build Artemis (non-main Examples)
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
run: |
cd activemq-artemis
mvn -s ../activemq-artemis-examples/.github/maven-settings.xml install -DskipTests -T1C
- name: Identify Examples Version (non-main Examples)
id: identify-examples-version
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
run: |
cd activemq-artemis-examples
sed -i "/<parent>/,/<version>/ s~<version>[^<]*~<version>${{ steps.identify-artemis-version.outputs.artemis-build-version }}~g" ./pom.xml
CURRENT_EXAMPLES_BUILD_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Current Examples version: ${CURRENT_EXAMPLES_BUILD_VERSION}"
echo "examples-build-version=${CURRENT_EXAMPLES_BUILD_VERSION}" >> $GITHUB_OUTPUT
- name: Set Examples Version to Artemis Version (non-main Examples)
if: ${{ ((github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main')) && steps.identify-artemis-version.outputs.artemis-build-version != steps.identify-examples-version.outputs.examples-build-version }}
run: |
cd activemq-artemis-examples
./scripts/update-examples-version.sh ${{ steps.identify-artemis-version.outputs.artemis-build-version }}
- name: Verify Examples
run: |
cd activemq-artemis-examples
./scripts/run-examples.sh
- name: Clean Up Before Caching
run: |
rm -rf ~/.m2/repository/org/apache/activemq/tests
rm -rf ~/.m2/repository/org/apache/activemq/examples
if [ -d ~/.m2/repository/org/apache/activemq ]; then find ~/.m2/repository/org/apache/activemq -name "*-SNAPSHOT" -type d -prune -exec rm -r '{}' \; ; fi
checks:
name: Compile Check
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
java: [ 11 ]
steps:
- uses: actions/checkout@v4
with:
path: activemq-artemis-examples
- name: Cache Maven Local Repo
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@v4
with:
path: |
~/.m2/repository/
key: ${{ runner.os }}-mvn-${{ hashFiles('activemq-artemis-examples/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-mvn-
- name: Install JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Checkout Artemis Repo (non-main Examples)
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
uses: actions/checkout@v4
with:
repository: ${{ env.ARTEMIS_REPO }}
ref: ${{ env.ARTEMIS_BRANCH }}
path: activemq-artemis
- name: Identify Artemis Version (non-main Examples)
id: identify-artemis-version
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
run: |
cd activemq-artemis
CURRENT_ARTEMIS_BUILD_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Current Artemis version: ${CURRENT_ARTEMIS_BUILD_VERSION}"
echo "artemis-build-version=${CURRENT_ARTEMIS_BUILD_VERSION}" >> $GITHUB_OUTPUT
- name: Build Artemis (non-main Examples)
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
run: |
cd activemq-artemis
mvn -s ../activemq-artemis-examples/.github/maven-settings.xml install -DskipTests -T1C
- name: Identify Examples Version (non-main Examples)
id: identify-examples-version
if: ${{ (github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main') }}
run: |
cd activemq-artemis-examples
sed -i "/<parent>/,/<version>/ s~<version>[^<]*~<version>${{ steps.identify-artemis-version.outputs.artemis-build-version }}~g" ./pom.xml
CURRENT_EXAMPLES_BUILD_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Current Examples version: ${CURRENT_EXAMPLES_BUILD_VERSION}"
echo "examples-build-version=${CURRENT_EXAMPLES_BUILD_VERSION}" >> $GITHUB_OUTPUT
- name: Set Examples Version to Artemis Version (non-main Examples)
if: ${{ ((github.event_name == 'pull_request' && github.base_ref != 'main') || (github.event_name != 'pull_request' && github.ref != 'refs/heads/main')) && steps.identify-artemis-version.outputs.artemis-build-version != steps.identify-examples-version.outputs.examples-build-version }}
run: |
cd activemq-artemis-examples
./scripts/update-examples-version.sh ${{ steps.identify-artemis-version.outputs.artemis-build-version }}
- name: Build Examples
run: |
cd activemq-artemis-examples
mvn -s .github/maven-settings.xml package -Prelease
- name: Clean Up Before Caching
run: |
rm -rf ~/.m2/repository/org/apache/activemq/tests
rm -rf ~/.m2/repository/org/apache/activemq/examples
if [ -d ~/.m2/repository/org/apache/activemq ]; then find ~/.m2/repository/org/apache/activemq -name "*-SNAPSHOT" -type d -prune -exec rm -r '{}' \; ; fi