Skip to content

Commit

Permalink
[core] Update common files for branch 3.3.x (micronaut-projects#6835)
Browse files Browse the repository at this point in the history
Co-authored-by: Alvaro Sanchez-Mariscal <alvaro.sanchezmariscal@gmail.com>
  • Loading branch information
micronaut-build and alvarosanchez authored Mar 9, 2022
1 parent 93ff5f9 commit 5f79a99
Show file tree
Hide file tree
Showing 42 changed files with 311 additions and 183 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/central-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: v${{ github.event.inputs.release_version }}
- uses: gradle/wrapper-validation-action@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependency-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
dependency-updates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/cache@v2.1.7
with:
path: ~/.gradle/caches
Expand All @@ -32,7 +32,7 @@ jobs:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
run: ./gradlew useLatestVersions
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3.12.1
uses: peter-evans/create-pull-request@v3.14.0
with:
token: ${{ secrets.GH_TOKEN }}
committer: micronaut-build <${{ secrets.MICRONAUT_BUILD_EMAIL }}>
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/graalvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,28 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['java11', 'java17']
java: ['11', '17']
steps:
# https://github.com/actions/virtual-environments/issues/709
- name: Free disk space
run: |
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get clean
df -h
- uses: actions/checkout@v2
df -h
- uses: actions/checkout@v3
- uses: actions/cache@v2.1.7
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup GraalVM CE
uses: DeLaGuardo/setup-graalvm@5.0
uses: graalvm/setup-graalvm@v1
with:
graalvm: 21.3.0
java: ${{ matrix.java }}
- name: Install Native Image
run: gu install native-image
version: '22.0.0.2'
java-version: ${{ matrix.java }}
components: 'native-image'
- name: Build with Gradle
run: |
if ./gradlew tasks --no-daemon --all | grep -w "testNativeImage"
Expand All @@ -57,7 +56,7 @@ jobs:
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
- name: Publish Test Report
if: always()
uses: mikepenz/action-junit-report@v2
uses: mikepenz/action-junit-report@v2.9.1
with:
check_name: GraalVM CE CI / Test Report (${{ matrix.java }})
check_name: GraalVM CE CI / Test Report (Java ${{ matrix.java }})
report_paths: '**/build/test-results/test/TEST-*.xml'
14 changes: 8 additions & 6 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get clean
df -h
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/cache@v2.1.7
with:
path: ~/.gradle/caches
Expand All @@ -49,15 +49,17 @@ jobs:
[ -f ./setup.sh ] && ./setup.sh || true
- name: Build with Gradle
run: |
# Awful hack for kapt and JDK 16. See https://youtrack.jetbrains.com/issue/KT-45545
if [ ${{ matrix.java }} == 16 ]; then export GRADLE_OPTS="-Dorg.gradle.jvmargs=--illegal-access=permit"; fi
./gradlew dependencyUpdates check --no-daemon --parallel --continue
env:
TESTCONTAINERS_RYUK_DISABLED: true
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
TESTCONTAINERS_RYUK_DISABLED: true
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
- name: Publish Test Report
if: always()
uses: mikepenz/action-junit-report@v2
uses: mikepenz/action-junit-report@v2.9.1
with:
check_name: Java CI / Test Report (${{ matrix.java }})
report_paths: '**/build/test-results/test/TEST-*.xml'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: github.repository != 'micronaut-projects/micronaut-project-template'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/cache@v2.1.7
with:
path: ~/.gradle/caches
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ on:
- '[1-9]+.[0-9]+.x'
jobs:
release_notes:
if: github.repository != 'micronaut-projects/micronaut-project-template'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Check if it has release drafter config file
id: check_release_drafter
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- uses: gradle/wrapper-validation-action@v1
Expand Down Expand Up @@ -60,12 +60,11 @@ jobs:
BRANCH: gh-pages
FOLDER: build/docs
VERSION: ${{ steps.release_version.outputs.release_version }}
TARGET_REPOSITORY: ${{ env.docsRepository }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USERNAME }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
- name: Checkout micronaut-core
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
repository: micronaut-projects/micronaut-core
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# WARNING: Do not edit this file directly. Instead, go to:
#
# https://github.com/micronaut-projects/micronaut-project-template/tree/master/.github/workflows
#
# and edit them there. Note that it will be sync'ed to all the Micronaut repos
name: Static Analysis
on:
push:
Expand All @@ -20,7 +25,9 @@ jobs:
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get clean
df -h
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/cache@v2.1.7
with:
path: ~/.gradle/caches
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ target/
.gradle/
.idea/
build/
!build-logic/src/main/java/io/micronaut/build
classes/
out/
*.db
Expand Down
40 changes: 20 additions & 20 deletions MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,35 @@ There are sometimes where we are not sure whether we want or can solve an issue.
There are also a bunch of `relates-to` labels that can be used to further categorise issues. This is helpful in projects
with a lot of issues, or projects where different people work on different parts or modules.

The majority of the issues are defined in the
The majority of the issues are defined in the
[management](https://github.com/micronaut-projects/management/blob/master/labels.tf) repo, and propagated via Terraform.
If you want new labels:

* If they can be beneficial to several repos, send a pull request to the management repo.
* If they are repo-specific, just go ahead and create them with the GitHub UI.

Finally, issues (especially bugs) should be prioritised with either `priority: high`, `priority: medium` or
Finally, issues (especially bugs) should be prioritised with either `priority: high`, `priority: medium` or
`priority: low`. Checkout the
[Issue Priority Labels](https://github.com/micronaut-projects/micronaut-core/wiki/Issue-Priority-Labels) document for
guidelines about when to use each of them.

## Review pull requests

Pull requests, regardless of whether they are created by internal or external contributors, should meet the following
Pull requests, regardless of whether they are created by internal or external contributors, should meet the following
criteria:

* All the GitHub checks are passing (CLA signed and builds passing).
* Code has a minimum quality, it uses the Micronaut APIs correctly, doesn't contain bad smells, etc. Essentially, the
type of things you would review in every other software project.
* Contains tests.
* Includes documentation.
* If it closes any issues,
* If it closes any issues,
[they should be linked](https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue)
either using closing keywords, or manually.

Regarding the target branch, backwards-compatible bug fixes and improvements typically target the default branch,
Regarding the target branch, backwards-compatible bug fixes and improvements typically target the default branch,
backwards-compatible enhancements target the next minor version branch, and breaking changes target the next major version
branch. Check the
branch. Check the
[Micronaut Module Versioning](https://github.com/micronaut-projects/micronaut-core/wiki/Micronaut-Module-Versioning)
document for more information.

Expand All @@ -78,7 +78,7 @@ patch/minor release we don't leak breaking changes. Check the
[Micronaut Module Branch Naming](https://github.com/micronaut-projects/micronaut-core/wiki/Micronaut-Module-Branch-Naming)
document for more information.

Note that
Note that
[Micronaut Core and Starter](https://github.com/micronaut-projects/micronaut-core/wiki/Micronaut-Core-and-Starter-Branching-Strategy)
follow a slightly different strategy.

Expand All @@ -93,17 +93,17 @@ All Micronaut repos have 2 dependency upgrade checking mechanism:
those defined in `gradle.properties`. It will also send different PRs for the same version upgrade if the artifact ID
is different. For example, if you have `com.example:client:1.0` and `com.example:server:1.0`, and a new 1.1 version
arrives for both, it will send 2 PRs, where they should both be upgraded at the same time.

2. To overcome those disadvantages, we have our own dependency upgrade solution based on the
[Gradle Use Latest Versions Plugin](https://github.com/patrikerdes/gradle-use-latest-versions-plugin). It runs daily
during weekdays.

The consequence of having both approaches in place is that we get multiple dependency upgrade PRs: one created by
`micronaut-build` via our automation, and one or many (one per dependency) created by Dependabot. When merging those, it
is better to prefer the `micronaut-build` ones, if possible, for 2 reasons: a) they attempt to upgrade multiple dependencies
is better to prefer the `micronaut-build` ones, if possible, for 2 reasons: a) they attempt to upgrade multiple dependencies
in a single PR, which creates less noise in the Git history; b) Once you merge that, Dependabot will react and automatically
close its own PRs if the dependecy is up-to-date.

When an upgrade to a new version arrives, we need to be careful when merging, so that we don't introduce an
unnecessary upgrade burden on our users. Read the
[Module Upgrade Strategy](https://github.com/micronaut-projects/micronaut-core/wiki/Module-Upgrade-Strategy) for more
Expand Down Expand Up @@ -157,7 +157,7 @@ Note that it is perfectly possible to have new workflows that aren't part of the
The release process is highly automated and normally involves just publishing a GitHub release. But before you get there,
there are some parts you need to understand first.

First of all, all the repos have an automatic changelog generation mechanism: when a change is made to the repo
First of all, all the repos have an automatic changelog generation mechanism: when a change is made to the repo
(a push event), it creates (or updates if there is already one) a draft release, calculating the next patch version. The
release notes will contain pull requests merged and issues closed since the last release.

Expand All @@ -168,21 +168,21 @@ If you are publishing a milestone or release candidate, check the pre-release ch

Note that the release tags must be preceded with `v`, e.g.: `v1.2.3`.

Once you publish the GitHub release, the
Once you publish the GitHub release, the
[Release GitHub Action workflow](https://github.com/micronaut-projects/micronaut-project-template/blob/master/.github/workflows/release.yml)
will kick off, performing the following steps:

* Pre-release: sets the `projectVersion` property in `gradle.properties` to the release version, and commit and pushes
* Pre-release: sets the `projectVersion` property in `gradle.properties` to the release version, and commit and pushes
the result.
* Generates documentation guide and publishes it to the `gh-pages` branch.
* Sends a pull request to Core to update the BOM.
* Post-release:
* Post-release:
* Determines the next patch version, and sets it as a `SNAPSHOT` version.
* Closes the milestone that matches the release version, and creates a new one for the next patch.

If everything goes well, you now need to manually trigger the Maven Central publishing workflow via the GitHub UI.

If there is an issue with the release, it's important not to trigger the Maven Central publishing workflow because once
If there is an issue with the release, it's important not to trigger the Maven Central publishing workflow because once
we publish a version to Maven Central we cannot change or remove it anymore.

There are some properties in `gradle.properties` that affect the release process:
Expand All @@ -192,19 +192,19 @@ There are some properties in `gradle.properties` that affect the release process
* `bomProperty`: in Micronaut Core's `gradle.properties`, the property that represents this module's version.
* `bomProperties`: if needed, additional properties for the BOM pull request.

For example, assuming a module has the release `1.0.0` as the latest version published, which was included in the
For example, assuming a module has the release `1.0.0` as the latest version published, which was included in the
Micronaut `2.2.0` BOM. If the next version you want to publish is:

* A new patch release (`1.0.1`): simply publish the existing draft release.
* A new minor release (`1.1.0`):
* A new minor release (`1.1.0`):
* Before the release, push a `1.0.x` branch off `master`.
* Bump the version in master to `1.1.0-SNAPSHOT`.
* Set the `githubCoreBranch` property to `2.3.x` (or `3.0.x` if it will be the next one).
* Edit the draft release setting the version to `1.1.0` in the release title, body, tag, etc.
* Publish the release.
* A new major release (`2.0.0`):
* A new major release (`2.0.0`):
* Before the release, push a `1.0.x` branch off `master`.
* Bump the version in master to `2.0.0-SNAPSHOT`.
* Set the `githubCoreBranch` property to `3.0.x` (or `2.3.x` if this new major version doesn't introduce breaking changes).
* Edit the draft release setting the version to `2.0.0` in the release title, body, tag, etc.
* Publish the release.
* Publish the release.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
import java.util.Collections;
import java.util.List;

/**
* A {@link TypedAnnotationMapper} for the {@link InterceptorBean} annotation.
*/
@Internal
public class InterceptorBeanMapper implements TypedAnnotationMapper<InterceptorBean> {

Expand Down
19 changes: 11 additions & 8 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@

<!-- Checks whether files end with a new line. -->
<!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
<!-- <module name="NewlineAtEndOfFile">-->
<!-- <property name="lineSeparator" value="lf"/>-->
<!-- </module>-->
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>

<!-- Checks that property files contain the same keys. -->
<!-- See https://checkstyle.org/config_misc.html#Translation -->
Expand Down Expand Up @@ -82,6 +82,10 @@
<property name="file" value="${config_loc}/suppressions.xml"/>
<property name="optional" value="false"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/custom-suppressions.xml"/>
<property name="optional" value="true"/>
</module>

<module name="TreeWalker">
<module name="SuppressionCommentFilter"/>
Expand All @@ -96,6 +100,7 @@
</module>
<module name="JavadocType"/>
<module name="JavadocStyle"/>
<module name="MissingJavadocType"/>

<!-- Checks for Naming Conventions. -->
<!-- See https://checkstyle.org/config_naming.html -->
Expand All @@ -110,9 +115,7 @@
<!-- Checks for imports -->
<!-- See https://checkstyle.org/config_import.html -->
<!-- <module name="AvoidStarImport"/> -->
<module name="IllegalImport">
<property name="illegalPkgs" value="sun, javax.inject"/>
</module>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports">
<property name="processJavadoc" value="false"/>
Expand Down Expand Up @@ -166,8 +169,8 @@
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!--<module name="MagicNumber">-->
<!--<property name="ignoreFieldDeclaration" value="true"/>-->
<!--<property name="ignoreHashCodeMethod" value="true"/>-->
<!--<property name="ignoreFieldDeclaration" value="true"/>-->
<!--<property name="ignoreHashCodeMethod" value="true"/>-->
<!--</module>-->
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
Expand Down
25 changes: 25 additions & 0 deletions config/checkstyle/custom-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>

<suppress checks="FileLength"
files="DefaultBeanContext.java|BeanDefinitionWriter.java|DefaultHttpClient.java|BeanDefinitionInjectProcessor.java|AbstractBeanDefinition.java|AbstractInitializableBeanDefinition.java|DefaultValidator.java|RoutingInBoundHandler.java|DefaultAnnotationMetadata.java|AbstractAnnotationMetadataBuilder.java"/>

<suppress checks="DeclarationOrder" files="UriTemplate.java"/>

<suppress checks="Header"
files="AnnotationClassReader.java|Attribute.java|Context.java|io[\\/]micronaut[\\/]core[\\/]util[\\/]clhm|AmazonInfo.java|DataCenterInfo.java|LeaseInfo.java|QueryStringDecoder.java|CronExpression.java|AntPathMatcher.java|MicronautAstBuilder.java|io[\\/]micronaut[\\/]http[\\/]netty[\\/]stream[\\/]package-info.java" />

<suppress checks=".*" files="FlowControlHandler.java" />

<suppress checks="ParameterNumber" files="DefaultHttpClient.java" />

<suppress checks="IllegalImport" files="JavaxProviderBeanDefinition.java" />

<suppress checks=".*" files=".*test-suite.*|.*benchmarks.*" />

</suppressions>
Loading

0 comments on commit 5f79a99

Please sign in to comment.