diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7ea65221..1c37fd66 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -24,9 +24,9 @@ jobs: cancel-in-progress: true 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 (PR) # Checkout the PR branch first, if it exists + if: github.head_ref # Only true if this is a PR. id: checkout-solver uses: actions/checkout@v4 continue-on-error: true @@ -36,14 +36,15 @@ jobs: 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' + 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: Prevent stale fork of timefold-solver + - name: Prevent stale fork of timefold-solver # Solver can't be stale if main branch of blessed repo requested. + if: ${{ steps.checkout-solver.outcome == 'success' }} env: BLESSED_REPO: "timefold-solver" BLESSED_BRANCH: ${{ endsWith(github.head_ref, '.x') && github.head_ref || 'main' }} @@ -66,6 +67,7 @@ jobs: # Clone timefold-solver-enterprise # 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-enterprise (PR) # Checkout the PR branch first, if it exists + if: github.head_ref # Only true if this is a PR. id: checkout-solver-enterprise uses: actions/checkout@v4 continue-on-error: true @@ -85,6 +87,7 @@ jobs: path: ./timefold-solver-enterprise fetch-depth: 0 # Otherwise merge will fail on account of not having history. - name: Prevent stale fork of timefold-solver-enterprise + if: steps.checkout-solver-enterprise.outcome == 'success' env: BLESSED_REPO: "timefold-solver-enterprise" BLESSED_BRANCH: ${{ endsWith(github.head_ref, '.x') && github.head_ref || 'main' }} @@ -101,6 +104,7 @@ jobs: uses: actions/checkout@v4 with: repository: TimefoldAI/timefold-solver-benchmarks + ref: ${{ github.head_ref }} path: ./timefold-solver-benchmarks - name: Build and test timefold-solver-benchmarks working-directory: ./timefold-solver-benchmarks diff --git a/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java b/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java index a006a6f3..9f299c55 100644 --- a/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java +++ b/src/main/java/ai/timefold/solver/benchmarks/micro/scoredirector/problems/AbstractProblem.java @@ -108,7 +108,7 @@ public final void setupIteration() { var solverScope = new SolverScope(); solverScope.setScoreDirector(scoreDirector); solverScope.setWorkingRandom(new Random(0)); // Fully reproducible random selection. - phaseScope = new LocalSearchPhaseScope<>(solverScope); + phaseScope = new LocalSearchPhaseScope<>(solverScope, 0); moveSelector.solvingStarted(solverScope); moveSelector.phaseStarted(phaseScope); }