Skip to content

Commit fbabf0f

Browse files
authored
Merge pull request #9 from grails-plugins/more-feedback
Build restructuring
2 parents 7eded3f + fc3f243 commit fbabf0f

43 files changed

Lines changed: 764 additions & 697 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: "Output Agent IP" # in the event your agent has network issues, you can use this to debug
2020
run: curl -s https://api.ipify.org
2121
- name: "📥 Checkout repository"
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2323
- name: "Export .sdkmanrc properties"
2424
uses: apache/grails-github-actions/export-gradle-properties@asf
2525
with:
@@ -28,14 +28,20 @@ jobs:
2828
- name: "Determine Java Version"
2929
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
3030
- name: "☕️ Setup JDK"
31-
uses: actions/setup-java@v4
31+
uses: actions/setup-java@v5
3232
with:
3333
distribution: ${{ env.JAVA_DISTRIBUTION }}
3434
java-version: ${{ env.SDKMANRC_java }}
3535
- name: 'Ensure Common Build Date' # to ensure a reproducible build
3636
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV"
37+
- name: "Export gradle.properties properties"
38+
uses: apache/grails-github-actions/export-gradle-properties@asf
3739
- name: "🐘 Setup Gradle"
38-
uses: gradle/actions/setup-gradle@v4
40+
uses: gradle/actions/setup-gradle@v5
41+
with:
42+
build-scan-publish: ${{ env.ciBuildScanPublish }}
43+
build-scan-terms-of-use-url: ${{ env.ciBuildScanTermsOfUseUrl }}
44+
build-scan-terms-of-use-agree: ${{ env.ciBuildScanTermsOfUseAgree }}
3945
- name: "🔨 Build project without tests"
4046
if: ${{ contains(github.event.head_commit.message, '[skip tests]') }}
4147
run: >
@@ -53,15 +59,16 @@ jobs:
5359
--rerun-tasks
5460
-PskipCodeStyle
5561
publish:
56-
# only run the publish task on this repo instead of forks
62+
# only run the publishing task on this repo (not on forks)
5763
if: github.repository_owner == 'grails-plugins' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
58-
needs: [ build ]
64+
needs: build
65+
name: "Publish Snapshot"
5966
runs-on: ubuntu-24.04
6067
steps:
6168
- name: "Output Agent IP" # in the event your agent has network issues, you can use this to debug
6269
run: curl -s https://api.ipify.org
6370
- name: "📥 Checkout repository"
64-
uses: actions/checkout@v4
71+
uses: actions/checkout@v6
6572
- name: "Export .sdkmanrc properties"
6673
uses: apache/grails-github-actions/export-gradle-properties@asf
6774
with:
@@ -70,30 +77,33 @@ jobs:
7077
- name: "Determine Java Version"
7178
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
7279
- name: "☕️ Setup JDK"
73-
uses: actions/setup-java@v4
80+
uses: actions/setup-java@v5
7481
with:
7582
distribution: ${{ env.JAVA_DISTRIBUTION }}
7683
java-version: ${{ env.SDKMANRC_java }}
7784
- name: 'Ensure Common Build Date' # to ensure a reproducible build
7885
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV"
86+
- name: "Export gradle.properties properties"
87+
uses: apache/grails-github-actions/export-gradle-properties@asf
7988
- name: "🐘 Setup Gradle"
80-
uses: gradle/actions/setup-gradle@v4
89+
uses: gradle/actions/setup-gradle@v5
90+
with:
91+
build-scan-publish: ${{ env.ciBuildScanPublish }}
92+
build-scan-terms-of-use-url: ${{ env.ciBuildScanTermsOfUseUrl }}
93+
build-scan-terms-of-use-agree: ${{ env.ciBuildScanTermsOfUseAgree }}
8194
- name: "📤 Publish Gradle Snapshot Artifacts"
8295
env:
8396
GRAILS_PUBLISH_RELEASE: 'false'
8497
MAVEN_PUBLISH_URL: 'https://central.sonatype.com/repository/maven-snapshots/'
8598
MAVEN_PUBLISH_USERNAME: ${{ secrets.NEXUS_PUBLISH_USERNAME }}
8699
MAVEN_PUBLISH_PASSWORD: ${{ secrets.NEXUS_PUBLISH_PASSWORD }}
87-
working-directory: './plugin'
88100
run: >
89101
../gradlew publish
90102
--no-build-cache
91103
--rerun-tasks
92104
- name: "📜 Generate Documentation"
93-
if: success()
94105
run: ./gradlew docs
95106
- name: "🚀 Publish to Github Pages"
96-
if: success()
97107
uses: apache/grails-github-actions/deploy-github-pages@asf
98108
env:
99109
GRADLE_PUBLISH_RELEASE: 'false'
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Coverage"
1+
name: "Code Coverage"
22
on:
33
push:
44
branches:
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-24.04
1616
steps:
1717
- name: "📥 Checkout repository"
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
- name: "Export .sdkmanrc properties"
2020
uses: apache/grails-github-actions/export-gradle-properties@asf
2121
with:
@@ -24,24 +24,30 @@ jobs:
2424
- name: "Determine Java Version"
2525
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
2626
- name: "☕️ Setup JDK"
27-
uses: actions/setup-java@v4
27+
uses: actions/setup-java@v5
2828
with:
2929
distribution: liberica
3030
java-version: ${{ env.SDKMANRC_java }}
31+
- name: "Export gradle.properties properties"
32+
uses: apache/grails-github-actions/export-gradle-properties@asf
3133
- name: "🐘 Setup Gradle"
32-
uses: gradle/actions/setup-gradle@v4
34+
uses: gradle/actions/setup-gradle@v5
35+
with:
36+
build-scan-publish: ${{ env.ciBuildScanPublish }}
37+
build-scan-terms-of-use-url: ${{ env.ciBuildScanTermsOfUseUrl }}
38+
build-scan-terms-of-use-agree: ${{ env.ciBuildScanTermsOfUseAgree }}
3339
- name: "🔨 Build and run tests"
3440
run: >
3541
./gradlew build
3642
--continue
3743
--stacktrace
3844
-PskipCodeStyle
39-
- name: "📊 Post coverage summary"
45+
- name: "📊 Post code coverage summary"
4046
if: always()
4147
run: |
42-
REPORT="coverage/build/reports/jacoco/jacocoAggregatedReport/jacocoAggregatedReport.xml"
48+
REPORT="code-coverage/build/reports/jacoco/jacocoAggregatedReport/jacocoAggregatedReport.xml"
4349
if [ ! -f "$REPORT" ]; then
44-
echo "::warning::Coverage report not found at $REPORT"
50+
echo "::warning::Code Coverage report not found at $REPORT"
4551
exit 0
4652
fi
4753

.github/workflows/code-style.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-24.04
1616
steps:
1717
- name: "📥 Checkout repository"
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919
- name: "Export .sdkmanrc properties"
2020
uses: apache/grails-github-actions/export-gradle-properties@asf
2121
with:
@@ -24,12 +24,18 @@ jobs:
2424
- name: "Determine Java Version"
2525
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
2626
- name: "☕️ Setup JDK"
27-
uses: actions/setup-java@v4
27+
uses: actions/setup-java@v5
2828
with:
2929
distribution: liberica
3030
java-version: ${{ env.SDKMANRC_java }}
31+
- name: "Export gradle.properties properties"
32+
uses: apache/grails-github-actions/export-gradle-properties@asf
3133
- name: "🐘 Setup Gradle"
32-
uses: gradle/actions/setup-gradle@v4
34+
uses: gradle/actions/setup-gradle@v5
35+
with:
36+
build-scan-publish: ${{ env.ciBuildScanPublish }}
37+
build-scan-terms-of-use-url: ${{ env.ciBuildScanTermsOfUseUrl }}
38+
build-scan-terms-of-use-agree: ${{ env.ciBuildScanTermsOfUseAgree }}
3339
- name: "🎨 Run code style checks"
3440
run: >
3541
./gradlew codeStyle

.github/workflows/release.yml

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
types: [ published ]
55
permissions: { }
66
env:
7-
# to prevent throttling of the github api, include the github token in an environment variable since the build will check for it
7+
# To prevent throttling of the GitHub api,
8+
# include the GitHub token in an environment variable
9+
# since the build will check for it
810
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
911
GRAILS_PUBLISH_RELEASE: 'true'
1012
JAVA_DISTRIBUTION: 'liberica'
@@ -19,7 +21,7 @@ jobs:
1921
name: "Stage Jar Files"
2022
permissions:
2123
packages: read # pre-release workflow
22-
contents: write # to create release
24+
contents: write # to create a release
2325
issues: write # to modify milestones
2426
runs-on: ubuntu-24.04
2527
steps:
@@ -28,7 +30,7 @@ jobs:
2830
- name: "Output Agent IP" # in the event RAO blocks this agent, this can be used to debug it
2931
run: curl -s https://api.ipify.org
3032
- name: "📥 Checkout repository"
31-
uses: actions/checkout@v4
33+
uses: actions/checkout@v6
3234
with:
3335
token: ${{ secrets.GITHUB_TOKEN }}
3436
ref: ${{ env.TAG }}
@@ -49,12 +51,18 @@ jobs:
4951
- name: "Determine Java Version"
5052
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
5153
- name: "☕️ Setup JDK"
52-
uses: actions/setup-java@v4
54+
uses: actions/setup-java@v5
5355
with:
5456
distribution: ${{ env.JAVA_DISTRIBUTION }}
5557
java-version: ${{ env.SDKMANRC_java }}
58+
- name: "Export gradle.properties properties"
59+
uses: apache/grails-github-actions/export-gradle-properties@asf
5660
- name: "🐘 Setup Gradle"
57-
uses: gradle/actions/setup-gradle@v4
61+
uses: gradle/actions/setup-gradle@v5
62+
with:
63+
build-scan-publish: ${{ env.ciBuildScanPublish }}
64+
build-scan-terms-of-use-url: ${{ env.ciBuildScanTermsOfUseUrl }}
65+
build-scan-terms-of-use-agree: ${{ env.ciBuildScanTermsOfUseAgree }}
5866
- name: "⚙️ Run pre-release"
5967
uses: apache/grails-github-actions/pre-release@asf
6068
env:
@@ -71,7 +79,6 @@ jobs:
7179
./gradlew
7280
-Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg
7381
publishMavenPublicationToSonatypeRepository
74-
publishPluginMavenPublicationToSonatypeRepository
7582
closeSonatypeStagingRepository
7683
- name: "Generate Build Date file"
7784
run: echo "$SOURCE_DATE_EPOCH" >> build/BUILD_DATE.txt
@@ -92,7 +99,7 @@ jobs:
9299
- name: "📝 Establish release version"
93100
run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV"
94101
- name: "📥 Checkout repository"
95-
uses: actions/checkout@v4
102+
uses: actions/checkout@v6
96103
with:
97104
token: ${{ secrets.GITHUB_TOKEN }}
98105
ref: ${{ env.TAG }}
@@ -104,12 +111,18 @@ jobs:
104111
- name: "Determine Java Version"
105112
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
106113
- name: "☕️ Setup JDK"
107-
uses: actions/setup-java@v4
114+
uses: actions/setup-java@v5
108115
with:
109116
distribution: ${{ env.JAVA_DISTRIBUTION }}
110117
java-version: ${{ env.SDKMANRC_java }}
118+
- name: "Export gradle.properties properties"
119+
uses: apache/grails-github-actions/export-gradle-properties@asf
111120
- name: "🐘 Setup Gradle"
112-
uses: gradle/actions/setup-gradle@v4
121+
uses: gradle/actions/setup-gradle@v5
122+
with:
123+
build-scan-publish: ${{ env.ciBuildScanPublish }}
124+
build-scan-terms-of-use-url: ${{ env.ciBuildScanTermsOfUseUrl }}
125+
build-scan-terms-of-use-agree: ${{ env.ciBuildScanTermsOfUseAgree }}
113126
- name: "📤 Release staging repository"
114127
env:
115128
NEXUS_PUBLISH_USERNAME: ${{ secrets.MAVEN_USERNAME }}
@@ -131,7 +144,7 @@ jobs:
131144
- name: "📝 Establish release version"
132145
run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV"
133146
- name: "📥 Checkout repository"
134-
uses: actions/checkout@v4
147+
uses: actions/checkout@v6
135148
with:
136149
token: ${{ secrets.GITHUB_TOKEN }}
137150
ref: ${{ env.TAG }}
@@ -143,12 +156,18 @@ jobs:
143156
- name: "Determine Java Version"
144157
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
145158
- name: "☕️ Setup JDK"
146-
uses: actions/setup-java@v4
159+
uses: actions/setup-java@v5
147160
with:
148161
distribution: ${{ env.JAVA_DISTRIBUTION }}
149162
java-version: ${{ env.SDKMANRC_java }}
163+
- name: "Export gradle.properties properties"
164+
uses: apache/grails-github-actions/export-gradle-properties@asf
150165
- name: "🐘 Setup Gradle"
151-
uses: gradle/actions/setup-gradle@v4
166+
uses: gradle/actions/setup-gradle@v5
167+
with:
168+
build-scan-publish: ${{ env.ciBuildScanPublish }}
169+
build-scan-terms-of-use-url: ${{ env.ciBuildScanTermsOfUseUrl }}
170+
build-scan-terms-of-use-agree: ${{ env.ciBuildScanTermsOfUseAgree }}
152171
- name: "🔨 Build Documentation"
153172
run: ./gradlew docs
154173
- name: "🚀 Publish to Github Pages"
@@ -168,26 +187,5 @@ jobs:
168187
issues: write # required for milestone closing
169188
pull-requests: write # to create the PR that will increment the version
170189
steps:
171-
- name: "📝 Establish release version"
172-
run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV"
173-
- name: "📥 Checkout repository"
174-
uses: actions/checkout@v4
175-
with:
176-
token: ${{ secrets.GITHUB_TOKEN }}
177-
ref: ${{ env.TAG }}
178-
- name: "Export .sdkmanrc properties"
179-
uses: apache/grails-github-actions/export-gradle-properties@asf
180-
with:
181-
file: ".sdkmanrc"
182-
prefix: "SDKMANRC_"
183-
- name: "Determine Java Version"
184-
run: echo "SDKMANRC_java=${{ env.SDKMANRC_java }}" | sed 's/-.*//' >> $GITHUB_ENV
185-
- name: "☕️ Setup JDK"
186-
uses: actions/setup-java@v4
187-
with:
188-
distribution: ${{ env.JAVA_DISTRIBUTION }}
189-
java-version: ${{ env.SDKMANRC_java }}
190-
- name: "🐘 Setup Gradle"
191-
uses: gradle/actions/setup-gradle@v4
192190
- name: "⚙️ Run post-release"
193191
uses: apache/grails-github-actions/post-release@asf

.skills/example-apps.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ The `examples/` directory can contain more than one app. Different apps can test
4747
All apps under `examples/` are auto-discovered by `settings.gradle`:
4848

4949
```groovy
50-
def examples = file('examples').list()
50+
def examples = file('examples').listFiles({ it.directory } as FileFilter)
5151
examples.each { example ->
52-
include example
53-
project(":$example").projectDir = file("examples/$example")
52+
include example.name
53+
project(":$example.name").projectDir = file("examples/$example.name")
5454
}
5555
```
5656

57-
New apps are also automatically included in coverage aggregation -- `coverage/build.gradle` discovers all example apps
57+
New apps are also automatically included in coverage aggregation -- `code-coverage/build.gradle` discovers all example apps
5858
under `examples/` at configuration time, so no manual registration is needed.
5959

6060
## Project Structure
@@ -90,9 +90,7 @@ Example apps apply convention plugins and declare their own dependencies:
9090

9191
```groovy
9292
plugins {
93-
id 'org.grails.plugins.servertiming.compile'
94-
id 'org.grails.plugins.servertiming.testing'
95-
id 'org.grails.plugins.servertiming.example'
93+
id 'config.example-app'
9694
}
9795
9896
version = projectVersion
@@ -119,7 +117,7 @@ dependencies {
119117

120118
Key patterns:
121119

122-
- Apply `compile`, `testing`, and `example` convention plugins
120+
- Apply `example-app` convention plugin
123121
- Depend on the plugin via `project(':grails-server-timing')`
124122
- NEVER apply `project-publish` -- example apps are not published
125123
- NEVER apply `plugin` -- example apps are applications, not plugins
@@ -159,7 +157,7 @@ class ServerTimingIntegrationSpec extends Specification {
159157
### What to test in integration tests
160158

161159
- HTTP headers are present and correctly formatted
162-
- Timing values are within expected ranges (e.g., slow action >= 200ms)
160+
- Timing values are within expected ranges (e.g., slow action >= 200 ms)
163161
- Different response types (GSP views, JSON, plain text) all include headers
164162
- Static assets include `other`/`total` metrics but not `action`/`view`
165163
- Header format matches the W3C Server Timing specification
@@ -169,10 +167,10 @@ class ServerTimingIntegrationSpec extends Specification {
169167
### Integration test patterns
170168

171169
1. **Use `RestTemplate` or similar HTTP client** -- test real HTTP round-trips
172-
2. **Verify headers, not internals** -- assert on `Server-Timing` header values, not internal class state
170+
2. **Verify headers, not internals** assert on `Server-Timing` header values, not internal class state
173171
3. **Use timing thresholds, not exact values** -- assert `>= 200ms`, never `== 203ms`
174-
4. **Test edge cases** -- static assets, JSON responses, redirects, errors
175-
5. **Extract helper methods** -- centralize header parsing (e.g., `extractDuration()`)
172+
4. **Test edge cases** static assets, JSON responses, redirects, errors
173+
5. **Extract helper methods** centralize header parsing (e.g., `extractDuration()`)
176174

177175
### Test organization
178176

@@ -185,12 +183,12 @@ class ServerTimingIntegrationSpec extends Specification {
185183

186184
Example apps should include purpose-built controllers and views that exercise the plugin's features:
187185

188-
- **Fast actions** -- verify baseline header presence
189-
- **Slow actions** (with `Thread.sleep()`) -- verify timing accuracy
190-
- **Variable delay actions** -- parameterized timing tests
191-
- **Slow views** (GSP with embedded sleep) -- verify view timing separation
192-
- **JSON/text responses** -- verify non-GSP response types
193-
- **Multiple operations** -- verify timing accumulation
186+
- **Fast actions** verify baseline header presence
187+
- **Slow actions** (with `Thread.sleep()`) verify timing accuracy
188+
- **Variable delay actions** parameterized timing tests
189+
- **Slow views** (GSP with embedded sleep) verify view timing separation
190+
- **JSON/text responses** verify non-GSP response types
191+
- **Multiple operations** verify timing accumulation
194192

195193
These are test fixtures that live in the example app, NOT in the plugin project.
196194

0 commit comments

Comments
 (0)