-
-
Notifications
You must be signed in to change notification settings - Fork 974
Hibernate 7 - Step 1 #15654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hibernate 7 - Step 1 #15654
Changes from all commits
d55aff3
4084938
ec859bf
214a291
5ac6e2c
caa32c4
5112d89
ed0916d
01c27f9
c8cb43f
f18465a
4c5c563
fbe6d04
ba6d0aa
0366b20
a45a8e5
5f08705
4efa439
4cbcd71
7771d73
d79c78b
fc7bfeb
153e555
954f89e
2641faf
89420e7
375e0b6
02c169a
88a5192
ac007f3
f9da7d5
d717f96
e3cad41
093f41e
6c82efb
4b5c6e9
a14af3a
8ab6e91
0a43922
15f2be6
81c434b
dbe666a
4ba3d02
2c02980
1c6a015
d8ca9dc
36d649e
a951477
772415b
37c2b90
bd741c6
7fc83fd
58de59f
62befcd
ee4ab14
f76e090
7ba9c67
6bbe3b3
982a4ea
ec17b09
7a410b3
af842ab
f8d475c
dfb255f
d959e4e
5436ff0
340a1f1
263f7ed
caeb724
4eca4ca
ada5f2a
3fa03ac
b04a50f
1c61325
39d64f1
09f395c
6fdd688
ba235da
33412ee
f0d82f6
80d02ee
3cf0cc7
06ddb63
02b96c9
76123ad
9c17ce7
5549cec
7931bc7
637da9c
bb990dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| --- | ||
| name: test-fixer | ||
| description: Guide for running, reviewing, and fixing test failures across grails-core modules using Gradle test reports | ||
| license: Apache-2.0 | ||
| --- | ||
| <!-- | ||
| SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. | ||
| --> | ||
|
|
||
| ## What I Do | ||
|
|
||
| - Guide targeted and full test runs across grails-core modules. | ||
| - Help interpret Gradle HTML and XML test reports. | ||
| - Help triage failing specs, static state pollution, and module-specific regressions. | ||
|
|
||
| ## When to Use Me | ||
|
|
||
| Activate this skill when: | ||
|
|
||
| - Running a failing module or specific spec. | ||
| - Preparing a commit and verifying affected module tests. | ||
| - Triaging regressions after a dependency upgrade or refactor. | ||
| - Reviewing aggregate test results from `:grails-test-report`. | ||
|
|
||
| --- | ||
|
|
||
| ## Key Tasks | ||
|
|
||
| ### Targeted Testing Recommended | ||
|
|
||
| To save time, run only related tests: | ||
|
|
||
| ```bash | ||
| ./gradlew :grails-data-hibernate7-core:test --tests "grails.gorm.tests.BasicCollection*" | ||
| ``` | ||
|
|
||
| ### Full Run | ||
|
|
||
| ```bash | ||
| ./gradlew test --continue | ||
| ``` | ||
|
|
||
| Use `--continue` when you need later modules to run after an earlier module fails. | ||
|
|
||
| --- | ||
|
|
||
| ## Aggregate Test Reports | ||
|
|
||
| The `grails-test-report` project owns repository test aggregation. | ||
|
|
||
| ```bash | ||
| ./gradlew :grails-test-report:check --continue | ||
| ``` | ||
|
|
||
| This generates: | ||
|
|
||
| - Unit HTML: `grails-test-report/build/reports/tests/test/index.html` | ||
| - Unit Markdown: `grails-test-report/build/reports/tests/test.md` | ||
| - Integration HTML: `grails-test-report/build/reports/tests/integrationTest/index.html` | ||
| - Integration Markdown: `grails-test-report/build/reports/tests/integrationTest.md` | ||
| - Combined HTML: `grails-test-report/build/reports/tests/combined/index.html` | ||
| - Combined Markdown: `grails-test-report/build/reports/tests/combined.md` | ||
|
|
||
| The aggregate report includes root subprojects that define matching `test` or `integrationTest` tasks. | ||
|
|
||
| The collected unit and integration `Test` tasks are finalized by their matching aggregate report tasks. Reports are attempted after failures and after targeted module test runs, but they summarize the XML results currently available on disk. Use `--continue` for full-suite runs so Gradle keeps scheduling later test tasks after an earlier failure; without it, reports can be partial. Run `clean` first when stale XML results should be excluded. | ||
|
|
||
| --- | ||
|
|
||
| ## Running Tests for a Specific Module | ||
|
|
||
| ```bash | ||
| # All tests in a module | ||
| ./gradlew :grails-data-hibernate7-dbmigration:test | ||
|
|
||
| # A specific spec | ||
| ./gradlew :grails-data-hibernate7-dbmigration:test \ | ||
| --tests "org.grails.plugins.databasemigration.command.DbmGenerateGormChangelogCommandSpec" | ||
|
|
||
| # A specific feature method | ||
| ./gradlew :grails-data-hibernate7-core:test \ | ||
| --tests "org.grails.orm.hibernate.FooSpec.my feature name" | ||
|
|
||
| # Force rerun even if Gradle thinks it is up-to-date | ||
| ./gradlew :grails-data-hibernate7-core:test --rerun-tasks | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Test Source Layout | ||
|
|
||
| | Source set | Directory | Task | | ||
| |------------|-----------|------| | ||
| | Unit tests | `src/test/groovy/` | `test` | | ||
| | Integration tests | `src/integration-test/groovy/` | `integrationTest` | | ||
|
|
||
| Most specs in grails-core are unit tests (`src/test/groovy/`) run by the `test` task. A small number of modules use `integrationTest` for full Spring context tests. | ||
|
|
||
| --- | ||
|
|
||
| ## Parallel Test Execution | ||
|
|
||
| Tests run in parallel (`maxParallelForks` defaults to `4` on CI and to `availableProcessors * 3/4` otherwise; override with `-PmaxTestParallel`). This can cause: | ||
|
|
||
| - Static state pollution: one test mutating a static field that another test reads. | ||
| - Port conflicts: multiple test JVMs binding the same port. | ||
| - `@Shared` field contamination: shared state not properly cleaned up between feature methods. | ||
|
|
||
| To diagnose flaky failures, rerun with forced serial execution: | ||
|
|
||
| ```bash | ||
| ./gradlew :module:test -PmaxTestParallel=1 --rerun-tasks | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Test Configuration Flags | ||
|
|
||
| | Property | Effect | | ||
| |----------|--------| | ||
| | `skipTests` | Skips all `Test` tasks (build only) | | ||
| | `maxTestParallel=N` | Override parallel fork count | | ||
| | `onlyFunctionalTests` | Run only functional test suites | | ||
| | `skipHibernate7Tests` | Skip H7-specific test suites | | ||
| | `onlyMongodbTests` | Run only MongoDB test suites | | ||
| | `onlyCoreTests` | Run only core module tests | | ||
|
|
||
| --- | ||
|
|
||
| ## XML Report Location | ||
|
|
||
| Gradle writes JUnit XML test results to: | ||
|
|
||
| ```text | ||
| <module>/build/test-results/ | ||
| ├── test/ | ||
| │ └── TEST-org.grails.SomeSpec.xml | ||
| └── integrationTest/ | ||
| └── TEST-org.grails.SomeIntegrationSpec.xml | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ on: | |
| push: | ||
| branches: | ||
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be necessary, the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's here because I pulled forward the changes - my assumption is we'll remove in step 2 PR. When chaining PRs together, the later PRs won't run unless in this list. |
||
| pull_request: | ||
| workflow_dispatch: | ||
| # Queue jobs - cancel in-progress PR runs when new commits pushed, but allow branch builds to complete | ||
|
|
@@ -273,6 +274,7 @@ jobs: | |
| -PonlyFunctionalTests | ||
| -PskipCodeStyle | ||
| -PskipHibernate5Tests | ||
| -PskipHibernate7Tests | ||
| -PskipMongodbTests | ||
| mongodbFunctional: | ||
| if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} | ||
|
|
@@ -353,6 +355,44 @@ jobs: | |
| -PgrailsIndy=${{ matrix.indy }} | ||
| -PonlyHibernate5Tests | ||
| -PskipCodeStyle | ||
| hibernate7Functional: | ||
| if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} | ||
| name: "Hibernate7 Functional Tests (Java ${{ matrix.java }}, indy=${{ matrix.indy }})" | ||
| runs-on: ubuntu-24.04 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| java: [ 21, 25 ] | ||
| indy: [ false ] | ||
| include: | ||
| - java: 21 | ||
| indy: true | ||
| steps: | ||
| - name: "Output Agent IP" # in the event RAO blocks this agent, this can be used to debug it | ||
| run: curl -s https://api.ipify.org | ||
| - name: "📥 Checkout the repository" | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| - name: "☕️ Setup JDK" | ||
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 | ||
| with: | ||
| distribution: liberica | ||
| java-version: ${{ matrix.java }} | ||
| - name: "🐘 Setup Gradle" | ||
| uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0 | ||
| with: | ||
| cache-provider: basic # 'basic' uses the MIT-licensed, open-source cache provider; the default 'enhanced' provider (v6+) is proprietary (Gradle commercial Terms of Use) | ||
| develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} | ||
| - name: "🏃 Run Functional Tests" | ||
| env: | ||
| GITHUB_MAVEN_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
| run: > | ||
| ./gradlew bootJar check | ||
| --continue | ||
| --rerun-tasks | ||
| --stacktrace | ||
| -PgrailsIndy=${{ matrix.indy }} | ||
| -PonlyHibernate7Tests | ||
| -PskipCodeStyle | ||
| publishGradle: | ||
| if: github.repository_owner == 'apache' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | ||
| needs: [ buildGradle ] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,10 +17,12 @@ name: "CI - Groovy Joint Validation Build" | |
| on: | ||
| push: | ||
| branches: | ||
| - '[4-9]+.[0-9]+.x' | ||
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
| pull_request: | ||
| branches: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder why we are filtering pull_request target branches?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous answer. |
||
| - '[4-9]+.[0-9]+.x' | ||
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
| workflow_dispatch: | ||
| # queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits | ||
| concurrency: | ||
|
|
@@ -124,7 +126,6 @@ jobs: | |
| run: | | ||
| cd groovy | ||
| ./gradlew pTML -x groovydoc -x javadoc -x javadocAll -x groovydocAll -x asciidoc -x docGDK | ||
|
|
||
| build_grails: | ||
| needs: [build_groovy] | ||
| runs-on: ubuntu-latest | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,14 +17,12 @@ name: "Licensing - RAT Report" | |
| on: | ||
| push: | ||
| branches: | ||
| - '[4-9]+.[0-9]+.x' | ||
| - '[3-9]+.[3-9]+.x' | ||
| - license-audit | ||
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
| pull_request: | ||
| branches: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder why we are filtering pull_request target branches?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See previous answer. |
||
| - '[4-9]+.[0-9]+.x' | ||
| - '[3-9]+.[3-9]+.x' | ||
| - license-audit | ||
| - '[0-9]+.[0-9]+.x' | ||
| - '8.0.x-hibernate7.*' | ||
| workflow_dispatch: | ||
| # queue jobs and only allow 1 run per branch due to the likelihood of hitting GitHub resource limits | ||
| concurrency: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I wonder why we are filtering pull_request target branches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming because actions have finite limits and we didn't want it running until a PR was opened against the main branch? I'm not sure though, I think we should revisit this in the weekly.