-
Notifications
You must be signed in to change notification settings - Fork 84
254 lines (243 loc) · 10.9 KB
/
pull_request_maven_long_running.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
name: Maven Long-Running
on:
# Enables the workflow to run on PRs from forks.
# CI will only run for trusted users, to prevent stealing of secrets.
pull_request_target:
branches: [stable, development, '*.x']
types:
- opened
- reopened
- synchronize
paths:
- 'pom.xml'
- 'java/**/*'
- 'kotlin/**/*'
- '.github/**/*.yml'
jobs:
# Check if the user is a member of the organization; if so, allow the PR to sail through.
known_user:
runs-on: ubuntu-latest
outputs:
is_member_of_org: ${{ steps.auth_check.outputs.authorized }}
steps:
- id: auth_check
env:
GH_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} # Release account is a Solver Gatekeeper.
shell: bash
run: |
# -g to allow actors such as dependabot[bot]
ORG_MEMBERSHIP=`curl -g -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GH_TOKEN" "https://api.github.com/orgs/TimefoldAI/memberships/${{ github.actor }}" | jq -r '.state == "active"'`
echo "authorized=$ORG_MEMBERSHIP" >> "$GITHUB_OUTPUT"
- id: validation
shell: bash
run: |
echo "Authorized user: ${{ steps.auth_check.outputs.authorized }}"
# If the user is not a member, require a member to approve the PR.
approval_required:
needs: known_user
environment:
${{
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository &&
(needs.known_user.outputs.is_member_of_org != 'true' || github.actor == 'dependabot[bot]') &&
'external' || 'internal'
}}
runs-on: ubuntu-latest
steps:
- run: true
build-quarkus:
needs: approval_required
concurrency:
group: pull_request_long_running-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.module }}-${{ matrix.java-version }}
cancel-in-progress: true
runs-on: ubuntu-latest
strategy:
matrix:
module: [
"kotlin/school-timetabling", "java/bed-allocation",
"java/conference-scheduling", "java/employee-scheduling", "java/facility-location",
"java/flight-crew-scheduling", "java/food-packaging", "java/maintenance-scheduling",
"java/meeting-scheduling", "java/order-picking", "java/project-job-scheduling",
"java/school-timetabling", "java/sports-league-scheduling", "java/task-assigning",
"java/tournament-scheduling", "java/vehicle-routing"
]
# Only one supported LTS; already too many jobs here.
# We choose 21 as Quarkus 3.17.2 has weird issues with Java 17 GraalVM,
# with Java 21+ GraalVM being recommended even for Java 17 projects.
# https://github.com/quarkusio/quarkus/issues/44877
java-version: [ 21 ]
timeout-minutes: 120
steps:
- name: Checkout timefold-quickstarts
uses: actions/checkout@v4
with:
path: ./timefold-quickstarts
ref: ${{ github.event.pull_request.head.sha }} # The GHA event will pull the main branch by default, and we must specify the PR reference version
- name: Checkout timefold-solver (PR) # Checkout the PR branch first, if it exists
id: checkout-solver
uses: actions/checkout@v4
continue-on-error: true
with:
repository: ${{ github.actor }}/timefold-solver
ref: ${{ github.head_ref }}
path: ./timefold-solver
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
- name: Checkout timefold-solver (main) # Checkout the main branch if the PR branch does not exist
if: steps.checkout-solver.outcome != 'success'
uses: actions/checkout@v4
with:
repository: TimefoldAI/timefold-solver
ref: main
path: ./timefold-solver
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
# Build and test
- name: "Setup GraalVM native image"
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{matrix.java-version}}
distribution: 'graalvm-community'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Quickly build timefold-solver
working-directory: ./timefold-solver
run: mvn -B -Dquickly clean install
- name: Test timefold-quickstarts (slow tests)
working-directory: ./timefold-quickstarts/${{matrix.module}}
run: mvn -B -Dslowly verify
- name: Test timefold-quickstarts (native tests)
working-directory: ./timefold-quickstarts/${{matrix.module}}
run: mvn -B -Dnative -Pnative verify
build-enterprise-quarkus:
needs: approval_required
concurrency:
group: pull_request_enterprise_long_running-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.module }}-${{ matrix.java-version }}
cancel-in-progress: true
runs-on: ubuntu-latest
strategy:
matrix:
module: [ "java/bed-allocation", "java/vehicle-routing"]
# Only one supported LTS; already too many jobs here.
# We choose 21 as Quarkus 3.17.2 has weird issues with Java 17 GraalVM,
# with Java 21+ GraalVM being recommended even for Java 17 projects.
# https://github.com/quarkusio/quarkus/issues/44877
java-version: [ 21 ]
timeout-minutes: 120
steps:
- name: Checkout timefold-quickstarts
uses: actions/checkout@v4
with:
path: ./timefold-quickstarts
ref: ${{ github.event.pull_request.head.sha }} # The GHA event will pull the main branch by default, and we must specify the PR reference version
- name: Checkout timefold-solver (PR) # Checkout the PR branch first, if it exists
id: checkout-solver
uses: actions/checkout@v4
continue-on-error: true
with:
repository: ${{ github.actor }}/timefold-solver
ref: ${{ github.head_ref }}
path: ./timefold-solver
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
- name: Checkout timefold-solver (main) # Checkout the main branch if the PR branch does not exist
if: steps.checkout-solver.outcome != 'success'
uses: actions/checkout@v4
with:
repository: TimefoldAI/timefold-solver
ref: main
path: ./timefold-solver
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
- name: Checkout timefold-solver-enterprise (PR) # Checkout the PR branch first, if it exists
id: checkout-solver-enterprise
uses: actions/checkout@v4
continue-on-error: true
with:
repository: TimefoldAI/timefold-solver-enterprise
ref: ${{ github.head_ref }}
token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} # Safe; only used to clone the repo and not stored in the fork.
path: ./timefold-solver-enterprise
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
- name: Checkout timefold-solver-enterprise (main) # Checkout the main branch if the PR branch does not exist
if: steps.checkout-solver-enterprise.outcome != 'success'
uses: actions/checkout@v4
with:
repository: TimefoldAI/timefold-solver-enterprise
ref: main
token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} # Safe; only used to clone the repo and not stored in the fork.
path: ./timefold-solver-enterprise
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
# Build and test
- name: "Setup GraalVM native image"
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{matrix.java-version}}
distribution: 'graalvm-community'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Quickly build timefold-solver
working-directory: ./timefold-solver
run: mvn -B -Dquickly -DskipTests clean install
- name: Quickly build timefold-solver-enterprise
working-directory: ./timefold-solver-enterprise
run: mvn -B -Dquickly -DskipTests clean install
- name: Test timefold-enterprise-quickstarts (enterprise native tests)
working-directory: ./timefold-quickstarts/${{matrix.module}}
run: mvn -B -Dnative -Denterprise -Pnative verify
build-spring-boot:
needs: approval_required
concurrency:
group: pull_request_long_running-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.module }}-${{ matrix.java-version }}
cancel-in-progress: true
runs-on: ubuntu-latest
strategy:
matrix:
module: [
"java/spring-boot-integration"
]
# Only one supported LTS; already too many jobs here.
# We choose 21 as Quarkus 3.17.2 has weird issues with Java 17 GraalVM,
# with Java 21+ GraalVM being recommended even for Java 17 projects.
# https://github.com/quarkusio/quarkus/issues/44877
java-version: [ 21 ]
timeout-minutes: 120
steps:
- name: Checkout timefold-quickstarts
uses: actions/checkout@v4
with:
path: ./timefold-quickstarts
ref: ${{ github.event.pull_request.head.sha }} # The GHA event will pull the main branch by default, and we must specify the PR reference version
- name: Checkout timefold-solver (PR) # Checkout the PR branch first, if it exists
id: checkout-solver
uses: actions/checkout@v4
continue-on-error: true
with:
repository: ${{ github.actor }}/timefold-solver
ref: ${{ github.head_ref }}
path: ./timefold-solver
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
- name: Checkout timefold-solver (main) # Checkout the main branch if the PR branch does not exist
if: steps.checkout-solver.outcome != 'success'
uses: actions/checkout@v4
with:
repository: TimefoldAI/timefold-solver
ref: main
path: ./timefold-solver
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
# Build and test
- name: "Setup GraalVM native image"
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{matrix.java-version}}
distribution: 'graalvm-community'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Quickly build timefold-solver
working-directory: ./timefold-solver
run: mvn -B -Dquickly clean install
- name: Test timefold-quickstarts (slow tests)
working-directory: ./timefold-quickstarts/${{matrix.module}}
run: mvn -B -Dslowly verify
- name: Test timefold-quickstarts (native tests)
working-directory: ./timefold-quickstarts/${{matrix.module}}
run: mvn -B -PnativeTest verify