-
Notifications
You must be signed in to change notification settings - Fork 87
85 lines (80 loc) · 3.28 KB
/
pull_request_gradle.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
name: Gradle CI
on:
pull_request:
branches: [stable, development, '*.x']
jobs:
build:
concurrency:
group: pull_request_gradle-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.quickstartDir }}
cancel-in-progress: true
runs-on: ubuntu-latest
strategy:
matrix:
quickstartDir: ['hello-world', 'use-cases/school-timetabling', 'technology/java-spring-boot']
timeout-minutes: 120
steps:
# Clone timefold-solver
# Need to check for stale repo, since Github is not aware of the build chain and therefore doesn't automate it.
- name: Checkout timefold-solver to access the scripts
uses: actions/checkout@v4
with:
path: './timefold-solver'
repository: 'TimefoldAI/timefold-solver'
- name: Find the proper timefold-solver repo and branch
env:
CHAIN_USER: ${{ github.actor }}
CHAIN_BRANCH: ${{ github.head_ref }}
CHAIN_REPO: "timefold-solver"
CHAIN_DEFAULT_BRANCH: ${{ endsWith(github.head_ref, '.x') && github.head_ref || 'main' }}
shell: bash
run: |
./timefold-solver/.github/scripts/check_chain_repo.sh
rm -rf ./timefold-solver
- name: Checkout the proper timefold-solver branch
uses: actions/checkout@v4
with:
repository: ${{ env.TARGET_CHAIN_USER }}/${{ env.TARGET_CHAIN_REPO }}
ref: ${{ env.TARGET_CHAIN_BRANCH }}
path: './timefold-solver'
fetch-depth: 0 # Otherwise merge in the next step will fail on account of not having history.
- name: Prevent stale fork of timefold-solver
env:
BLESSED_REPO: "timefold-solver"
BLESSED_BRANCH: ${{ endsWith(github.head_ref, '.x') && github.head_ref || 'main' }}
shell: bash
working-directory: ./timefold-solver
run: .github/scripts/prevent_stale_fork.sh
# Clone timefold-quickstarts
# No need to check for stale repo, as Github merges the main repo into the fork automatically.
- name: Checkout timefold-quickstarts
uses: actions/checkout@v4
with:
path: './timefold-quickstarts'
# Build the solver
- name: "Setup Java and Maven"
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Quickly build timefold-solver
working-directory: ./timefold-solver
run: mvn -B -Dquickly clean install
# Build and test the Gradle-enabled quickstarts
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-
- name: Build and test timefold-quickstarts
working-directory: ./timefold-quickstarts/${{ matrix.quickstartDir }}
run: gradle build
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties