Skip to content

Commit b205696

Browse files
timefold-releasetriceo
authored andcommitted
build: release version
1 parent 0edf233 commit b205696

File tree

539 files changed

+6364
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

539 files changed

+6364
-560
lines changed

.github/scripts/change_versions.sh

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#!/bin/bash
22

33
# Expects the following environment variables to be set:
4-
# $OLD_VERSION (Example: "1.1.0")
5-
# $NEW_VERSION (Example: "1.2.0")
4+
# $OLD_JAVA_VERSION (Example: "1.1.0")
5+
# $NEW_JAVA_VERSION (Example: "1.2.0")
6+
# $OLD_PYTHON_VERSION (Example: "1.1.0b0")
7+
# $NEW_PYTHON_VERSION (Example: "1.2.0b0")
68

7-
echo "Old version: $OLD_VERSION"
8-
echo "New version: $NEW_VERSION"
9+
echo "Old Java version: $OLD_JAVA_VERSION"
10+
echo "Old Python version: $OLD_PYTHON_VERSION"
11+
echo "New Java version: $NEW_JAVA_VERSION"
12+
echo "New Python version: $NEW_PYTHON_VERSION"
913

1014
# Replaces the old version by the new version.
11-
find . -name pom.xml | xargs sed -i "s/>$OLD_VERSION</>$NEW_VERSION</g"
12-
find . -name build.gradle | xargs sed -i "s/\"$OLD_VERSION\"/\"$NEW_VERSION\"/g"
15+
find . -name pom.xml | xargs sed -i "s/>$OLD_JAVA_VERSION</>$NEW_JAVA_VERSION</g"
16+
find . -name build.gradle | xargs sed -i "s/\"$OLD_JAVA_VERSION\"/\"$NEW_JAVA_VERSION\"/g"
17+
find . -name pyproject.toml | xargs sed -i "s/timefold == $OLD_PYTHON_VERSION/timefold == $NEW_PYTHON_VERSION/g"

.github/scripts/run_python_tests.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Expects the following environment variables to be set:
2+
# $TIMEFOLD_SOLVER_PYTHON_DIST (Example: "/timefold-solver-python/dist")
3+
cd python || exit 1
4+
for d in */;
5+
do
6+
if [ -f "$d/pyproject.toml" ]; then
7+
cd "$d" || exit 1
8+
if [ -d ".venv" ]; then
9+
rm -rf .venv
10+
fi
11+
python -m venv .venv
12+
. .venv/bin/activate
13+
pip install --find-links "$TIMEFOLD_SOLVER_PYTHON_DIST" . || exit 1
14+
pytest || exit 1
15+
deactivate
16+
cd .. || exit 1
17+
fi
18+
done

.github/workflows/pull_request_gradle.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
runs-on: ubuntu-latest
2929
strategy:
3030
matrix:
31-
module: ['hello-world', 'use-cases/school-timetabling', 'technology/java-spring-boot']
31+
module: ['java/hello-world', 'java/school-timetabling', 'java/spring-boot-integration']
3232
java-version: [ 17 ] # Only the first supported LTS; already too many jobs here.
3333
timeout-minutes: 120
3434
steps:

.github/workflows/pull_request_long_running.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
strategy:
2020
matrix:
2121
module: [
22-
"technology/kotlin-quarkus", "use-cases/bed-allocation",
23-
"use-cases/conference-scheduling", "use-cases/employee-scheduling", "use-cases/facility-location",
24-
"use-cases/flight-crew-scheduling", "use-cases/food-packaging", "use-cases/maintenance-scheduling",
25-
"use-cases/meeting-scheduling", "use-cases/order-picking", "use-cases/project-job-scheduling",
26-
"use-cases/school-timetabling", "use-cases/sports-league-scheduling", "use-cases/task-assigning",
27-
"use-cases/tournament-scheduling", "use-cases/vehicle-routing"
22+
"kotlin/school-timetabling", "java/bed-allocation",
23+
"java/conference-scheduling", "java/employee-scheduling", "java/facility-location",
24+
"java/flight-crew-scheduling", "java/food-packaging", "java/maintenance-scheduling",
25+
"java/meeting-scheduling", "java/order-picking", "java/project-job-scheduling",
26+
"java/school-timetabling", "java/sports-league-scheduling", "java/task-assigning",
27+
"java/tournament-scheduling", "java/vehicle-routing"
2828
]
2929
java-version: [ 17 ] # Only the first supported LTS; already too many jobs here.
3030
timeout-minutes: 120
@@ -91,7 +91,7 @@ jobs:
9191
strategy:
9292
matrix:
9393
module: [
94-
"technology/java-spring-boot"
94+
"java/spring-boot-integration"
9595
]
9696
java-version: [ 17 ] # Only the first supported LTS; already too many jobs here.
9797
timeout-minutes: 120
+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Python
2+
3+
on:
4+
push:
5+
branches: [stable, development, '*.x']
6+
paths:
7+
- '**/*.py'
8+
- '**/pyproject.toml'
9+
- '.github/**/*.yml'
10+
pull_request:
11+
branches: [stable, development, '*.x']
12+
paths:
13+
- '**/*.py'
14+
- '**/pyproject.toml'
15+
- '.github/**/*.yml'
16+
17+
jobs:
18+
build:
19+
concurrency:
20+
group: pull_request_python-${{ github.event_name }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.java-version }}-${{ matrix.python-version }}
21+
cancel-in-progress: true
22+
runs-on: ${{matrix.os}}
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, windows-latest, macOS-latest]
26+
java-version: [ 17 ] # Only the first supported LTS; already too many jobs here.
27+
# TODO: Add Python 3.10 once employee scheduling and school timetabling support it
28+
python-version: ['3.11', '3.12']
29+
timeout-minutes: 120
30+
steps:
31+
# Clone timefold-solver
32+
# Need to check for stale repo, since Github is not aware of the build chain and therefore doesn't automate it.
33+
- name: Checkout timefold-solver (PR) # Checkout the PR branch first, if it exists
34+
if: github.head_ref # Only true if this is a PR.
35+
id: checkout-solver-pr
36+
uses: actions/checkout@v4
37+
continue-on-error: true
38+
with:
39+
repository: ${{ github.actor }}/timefold-solver
40+
ref: ${{ github.head_ref }}
41+
path: ./timefold-solver
42+
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
43+
- name: Checkout timefold-solver (main) # Checkout the main branch if the PR branch does not exist
44+
if: ${{ steps.checkout-solver-pr.outcome != 'success' }}
45+
uses: actions/checkout@v4
46+
with:
47+
repository: TimefoldAI/timefold-solver
48+
ref: main
49+
path: ./timefold-solver
50+
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
51+
- name: Prevent stale fork of timefold-solver # Solver can't be stale if development/stable branch requested.
52+
if: ${{ steps.checkout-solver-pr.outcome == 'success' }}
53+
env:
54+
BLESSED_REPO: "timefold-solver"
55+
BLESSED_BRANCH: ${{ endsWith(github.head_ref, '.x') && github.head_ref || 'main' }}
56+
shell: bash
57+
working-directory: ./timefold-solver
58+
run: .github/scripts/prevent_stale_fork.sh
59+
60+
# Clone timefold-solver-python
61+
# Need to check for stale repo, since Github is not aware of the build chain and therefore doesn't automate it.
62+
- name: Checkout timefold-solver-python (PR) # Checkout the PR branch first, if it exists
63+
if: github.head_ref # Only true if this is a PR.
64+
id: checkout-solver-python-pr
65+
uses: actions/checkout@v4
66+
continue-on-error: true
67+
with:
68+
repository: ${{ github.actor }}/timefold-solver-python
69+
ref: ${{ github.head_ref }}
70+
path: ./timefold-solver-python
71+
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
72+
- name: Checkout timefold-solver-python (main) # Checkout the main branch if the PR branch does not exist
73+
if: ${{ steps.checkout-solver-python-pr.outcome != 'success' }}
74+
uses: actions/checkout@v4
75+
with:
76+
repository: TimefoldAI/timefold-solver-python
77+
ref: main
78+
path: ./timefold-solver-python
79+
fetch-depth: 0 # Otherwise merge will fail on account of not having history.
80+
- name: Prevent stale fork of timefold-solver-python # Solver can't be stale if development/stable branch requested.
81+
if: ${{ steps.checkout-solver-python-pr.outcome == 'success' }}
82+
env:
83+
BLESSED_REPO: "timefold-solver-python"
84+
BLESSED_BRANCH: ${{ endsWith(github.head_ref, '.x') && github.head_ref || 'main' }}
85+
shell: bash
86+
working-directory: ./timefold-solver-python
87+
run: ../timefold-solver/.github/scripts/prevent_stale_fork.sh
88+
89+
# Clone timefold-quickstarts
90+
# No need to check for stale repo, as Github merges the main repo into the fork automatically.
91+
- name: Checkout timefold-quickstarts
92+
uses: actions/checkout@v4
93+
with:
94+
path: './timefold-quickstarts'
95+
96+
# Build and test
97+
- name: "Setup Java and Maven"
98+
uses: actions/setup-java@v3
99+
with:
100+
java-version: ${{matrix.java-version}}
101+
distribution: 'temurin'
102+
cache: 'maven'
103+
104+
- name: Python Setup
105+
uses: actions/setup-python@v4
106+
with:
107+
python-version: ${{matrix.python-version}}
108+
cache: 'pip'
109+
cache-dependency-path: |
110+
**/pyproject.toml
111+
112+
- name: Install build
113+
run:
114+
python -m pip install --upgrade pip
115+
pip install build
116+
117+
- name: Quickly build timefold-solver
118+
working-directory: ./timefold-solver
119+
run: mvn -B -Dquickly -DskipTests clean install
120+
121+
- name: Build timefold-solver-python
122+
working-directory: ./timefold-solver-python
123+
run: python -m build
124+
125+
- name: Build and test timefold-quickstarts
126+
working-directory: ./timefold-quickstarts
127+
env:
128+
TIMEFOLD_SOLVER_PYTHON_DIST: "${{ github.workspace }}/timefold-solver-python/dist"
129+
run: .github/scripts/run_python_tests.sh

.github/workflows/release.yml

+13-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ name: Release
22
on:
33
workflow_dispatch:
44
inputs:
5-
version:
5+
java-version:
66
description: 'Community Edition version (e.g. 1.0.0)'
77
required: true
8+
python-version:
9+
description: 'Python Community Edition version (e.g. 1.0.0b0)'
10+
required: true
811
developmentBranch:
912
description: 'Development branch to cut the release from'
1013
default: development
@@ -45,12 +48,14 @@ jobs:
4548
git config user.name "Timefold Release Bot"
4649
git config user.email "[email protected]"
4750
git checkout -B ${{ github.event.inputs.releaseBranch }}
48-
export OLD_VERSION="$(find . -name pom.xml -exec grep '<version.ai.timefold.solver>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)"
49-
export NEW_VERSION="${{ github.event.inputs.version }}"
51+
export OLD_JAVA_VERSION="$(find . -name pom.xml -exec grep '<version.ai.timefold.solver>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)"
52+
export NEW_JAVA_VERSION="${{ github.event.inputs.java-version }}"
53+
export OLD_PYTHON_VERSION="$(find . -name pyproject.toml -exec grep 'timefold ==' {} \;|tail -n 1|cut -d\' -f1 --complement|cut -d\= -f3|cut -d\' -f1|xargs)"
54+
export NEW_PYTHON_VERSION="${{ github.event.inputs.python-version }}"
5055
.github/scripts/change_versions.sh
5156
mvn verify
5257
git commit -am "build: switch to version $NEW_VERSION"
53-
git tag -a "v${{ github.event.inputs.version }}" -m "Release version ${{ github.event.inputs.version }}"
58+
git tag -a "v${{ github.event.inputs.java-version }}" -m "Release version ${{ github.event.inputs.java-version }}"
5459
git push --tags
5560
5661
# Merge the release branch into the stable branch.
@@ -73,8 +78,10 @@ jobs:
7378
- name: Put back the 999-SNAPSHOT version on the release branch
7479
run: |
7580
git checkout ${{ github.event.inputs.releaseBranch }}
76-
export OLD_VERSION="$(find . -name pom.xml -exec grep '<version.ai.timefold.solver>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)"
77-
export NEW_VERSION="999-SNAPSHOT"
81+
export OLD_JAVA_VERSION="$(find . -name pom.xml -exec grep '<version.ai.timefold.solver>' {} \;|tail -n 1|cut -d\> -f1 --complement|cut -d\< -f1)"
82+
export NEW_JAVA_VERSION="999-SNAPSHOT"
83+
export OLD_PYTHON_VERSION="$(find . -name pyproject.toml -exec grep 'timefold ==' {} \;|tail -n 1|cut -d\' -f1 --complement|cut -d\= -f3|cut -d\' -f1|xargs)"
84+
export NEW_PYTHON_VERSION="999-dev0"
7885
.github/scripts/change_versions.sh
7986
git commit -am "build: move back to version $NEW_VERSION"
8087
git push origin ${{ github.event.inputs.releaseBranch }}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@ build
1414
*.iws
1515
*.iml
1616

17+
# Python files
18+
__pycache__
19+
.venv
20+
venv*
21+
1722
# Repository wide ignore mac DS_Store files
1823
.DS_Store

CONTRIBUTING.adoc

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
== Contributing to Timefold Quickstarts
2+
3+
This is an open source project, and you are more than welcome to contribute!
4+
5+
* Found an issue? https://github.com/TimefoldAI/timefold-quickstarts/issues[Submit an issue.]
6+
* Want to fix an issue or contribute an improvement? https://github.com/TimefoldAI/timefold-solver/discussions[Talk to us about your ideas] or just start coding:
7+
8+
. https://github.com/TimefoldAI/timefold-quickstarts/fork[Fork it.]
9+
. Create a feature branch: `git checkout -b feature`
10+
. Commit your changes with a comment: `git commit -m "feat: add shiny new feature"`
11+
(See xref:commit-messages[Commit messages] for details.)
12+
. Push to the branch to GitHub: `git push origin feature`
13+
. https://github.com/TimefoldAI/timefold-quickstarts/compare/development...development[Create a new Pull Request.]
14+
15+
The CI checks against your PR to ensure that it doesn't introduce errors.
16+
If the CI identifies a potential problem, our friendly PR maintainers will help you resolve it.
17+
18+
19+
=== Developing Python quickstarts
20+
21+
The Python quickstarts on the `development` branch uses the
22+
development `999-dev0` build of `timefold-solver`.
23+
This needs to be built locally:
24+
25+
. Clone https://github.com/TimefoldAI/timefold-solver-python[timefold-solver-python].
26+
27+
. Install `build`
28+
+
29+
[source,base]
30+
----
31+
$ pip install build
32+
----
33+
34+
. Build the main branch of `timefold-solver-python`
35+
+
36+
[source,base]
37+
----
38+
$ python -m build
39+
----
40+
41+
. Reference the `timefold-solver-python` build directory in your `~/.config/pip/pip.conf`:
42+
+
43+
[source,ini]
44+
----
45+
[global]
46+
find-links =
47+
/path/to/timefold-solver-python/dist
48+
----

0 commit comments

Comments
 (0)