Skip to content

build(deps): bump org.springframework.boot from 3.5.3 to 4.1.0 in /easy-paging-keyset-demo #123

build(deps): bump org.springframework.boot from 3.5.3 to 4.1.0 in /easy-paging-keyset-demo

build(deps): bump org.springframework.boot from 3.5.3 to 4.1.0 in /easy-paging-keyset-demo #123

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
detect:
name: Detect demos to build
runs-on: ubuntu-latest
outputs:
demos: ${{ steps.detect.outputs.demos }}
any: ${{ steps.detect.outputs.any }}
steps:
- uses: actions/checkout@v6
with:
# Always full history. We previously tried
# fetch-depth: ${{ github.event_name == 'pull_request' && 0 || 1 }}
# to avoid the cost on main pushes, but GitHub Actions evaluates that
# expression to `1` even on PRs (the `&& 0 || 1` ternary trap — 0 is
# falsy in Actions expressions, so `0 || 1` short-circuits to 1). That
# left PR checkouts shallow, `git diff $base HEAD` failed with
# "fatal: bad object", and the matrix silently went empty.
fetch-depth: 0
- id: detect
name: Determine which demos to build
shell: bash
run: |
set -euo pipefail
# A "demo" is any top-level directory containing a build.gradle.kts.
mapfile -t all_demos < <(find . -mindepth 2 -maxdepth 2 -name 'build.gradle.kts' -not -path './.*' -printf '%h\n' | sed 's|^\./||' | sort -u)
if [ "${{ github.event_name }}" = "pull_request" ]; then
# Build only demos whose files changed in this PR.
base="${{ github.event.pull_request.base.sha }}"
# Run git diff in two stages so we fail loudly on errors. The previous
# version used `mapfile < <(git diff ...)`, but process substitution
# hides the subshell's exit status from `set -e`, so a bad-object
# error produced an empty array and a silently-skipped build.
if ! changed_output="$(git diff --name-only "$base" HEAD)"; then
echo "::error::git diff against base $base failed (likely a shallow checkout — confirm fetch-depth: 0 on the checkout step)"
exit 1
fi
mapfile -t changed_files <<< "$changed_output"
demos_to_build=()
for d in "${all_demos[@]}"; do
for f in "${changed_files[@]}"; do
if [[ "$f" == "$d/"* ]]; then
demos_to_build+=("$d")
break
fi
done
done
else
# Push to main: build everything (catches drift from external bumps).
demos_to_build=("${all_demos[@]}")
fi
if [ ${#demos_to_build[@]} -eq 0 ]; then
echo "No demos to build."
echo "demos=[]" >> "$GITHUB_OUTPUT"
echo "any=false" >> "$GITHUB_OUTPUT"
else
printf 'Demos to build:\n'
printf ' - %s\n' "${demos_to_build[@]}"
demos_json=$(printf '%s\n' "${demos_to_build[@]}" | jq -R . | jq -s -c .)
echo "demos=$demos_json" >> "$GITHUB_OUTPUT"
echo "any=true" >> "$GITHUB_OUTPUT"
fi
build:
name: Build ${{ matrix.demo }}
needs: detect
if: needs.detect.outputs.any == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
demo: ${{ fromJson(needs.detect.outputs.demos) }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
- uses: gradle/actions/setup-gradle@v6
- name: Build
working-directory: ${{ matrix.demo }}
run: ./gradlew build --no-daemon