Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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@v4
with:
# PRs need full history to diff against the base branch.
fetch-depth: ${{ github.event_name == 'pull_request' && 0 || 1 }}

- 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 }}"
mapfile -t changed_files < <(git diff --name-only "$base" HEAD)
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@v4

- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'

- uses: gradle/actions/setup-gradle@v4

- name: Build
working-directory: ${{ matrix.demo }}
run: ./gradlew build --no-daemon
11 changes: 0 additions & 11 deletions .github/workflows/proof-html.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Gradle
.gradle/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

# IntelliJ IDEA
.idea/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

# Eclipse / STS
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

# VS Code
.vscode/

# NetBeans
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

# OS
.DS_Store
Thumbs.db

# Logs
*.log
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
# Welcome to your organization's demo respository
This code repository (or "repo") is designed to demonstrate the best GitHub has to offer with the least amount of noise.
# devslab-examples

The repo includes an `index.html` file (so it can render a web page), two GitHub Actions workflows, and a CSS stylesheet dependency.
Runnable examples for [devslab-kr](https://github.com/devslab-kr) Spring Boot starters and libraries.

Each subdirectory is an **independent** Spring Boot application with its own Gradle build. Pick one, `cd` into it, and run `./gradlew bootRun`.

## Examples

| Demo | Showcases | Maven Central coordinates |
| --- | --- | --- |
| _(none yet — first demo coming in a follow-up PR)_ | — | — |

## Conventions

- Each demo is a **standalone Gradle project** — its own `settings.gradle.kts`, `build.gradle.kts`, and `gradlew`. Demos do not share a root build, so their dependency versions and JDK targets can drift independently.
- Each demo depends on the **latest stable release** of the starter it showcases (pinned by version in `build.gradle.kts`). Dependabot bumps it on new releases.
- This repo is **not versioned or tagged** — demos are not published artifacts. `main` is the source of truth.
- Each demo has its own `README.md` with quickstart, prerequisites, and a tour of what the starter is doing.

## Adding a new demo

1. Create `<starter-shortname>-demo/` at the repo root.
2. Copy the layout of an existing demo (e.g. `easy-paging-demo/`) as a template.
3. Add a row to the table above linking to the demo and to its starter on Maven Central.
4. CI auto-detects the new demo from the presence of `build.gradle.kts` — no workflow changes needed.

## CI

Pull requests build only the demos whose files changed. Pushes to `main` build every demo (catches drift from starter version bumps).
1 change: 0 additions & 1 deletion index.html

This file was deleted.

9 changes: 0 additions & 9 deletions package.json

This file was deleted.

Loading