Skip to content

Commit 072f882

Browse files
authored
Merge branch 'master' into pr-2216
2 parents 792f8df + 0255ab4 commit 072f882

File tree

538 files changed

+17088
-5628
lines changed

Some content is hidden

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

538 files changed

+17088
-5628
lines changed

.github/workflows/branch.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Java Branch CI
2+
on:
3+
push:
4+
branches-ignore:
5+
- master
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
java: ['8', '11', '13']
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/cache@v1
15+
with:
16+
path: ~/.gradle/caches
17+
key: ${{ runner.os }}-micronaut-core-gradle-${{ hashFiles('**/*.gradle') }}
18+
restore-keys: |
19+
${{ runner.os }}-micronaut-core-gradle-
20+
- name: Set up JDK
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: ${{ matrix.java }}
24+
- name: Build with Gradle
25+
run: ./gradlew check --no-daemon --parallel --continue --build-cache

.github/workflows/gradle.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Java CI
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
java: ['8', '11', '13']
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/cache@v1
18+
with:
19+
path: ~/.gradle/caches
20+
key: ${{ runner.os }}-micronaut-core-gradle-${{ hashFiles('**/*.gradle') }}
21+
restore-keys: |
22+
${{ runner.os }}-micronaut-core-gradle-
23+
- uses: actions/cache@v1
24+
with:
25+
path: ~/.gradle/wrapper
26+
key: ${{ runner.os }}-micronaut-core-wrapper-${{ hashFiles('**/*.gradle') }}
27+
restore-keys: |
28+
${{ runner.os }}-micronaut-core-wrapper-
29+
- name: Set up JDK
30+
uses: actions/setup-java@v1
31+
with:
32+
java-version: ${{ matrix.java }}
33+
- name: Build with Gradle
34+
run: ./gradlew check --no-daemon --parallel --continue
35+
- name: Publish to JFrog OSS
36+
if: success() && github.event_name == 'push' && matrix.java == '8'
37+
env:
38+
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
39+
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
40+
run: ./gradlew publish docs --no-daemon
41+
- name: Publish to Github Pages
42+
if: success() && github.event_name == 'push' && matrix.java == '8'
43+
uses: micronaut-projects/micronaut-docs-deploy@master
44+
env:
45+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
46+
GH_REPOSITORY: micronaut-projects/micronaut-docs
47+
BASE_BRANCH: master
48+
BRANCH: gh-pages
49+
FOLDER: build/docs

.github/workflows/release.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: Set up JDK
12+
uses: actions/setup-java@v1
13+
with:
14+
java-version: 1.8
15+
ref: ${{ github.head_ref }}
16+
- name: Publish to Bintray
17+
env:
18+
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
19+
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
20+
run: ./gradlew assemble bintrayUpload docs --no-daemon && ./gradlew bintrayPublish --no-daemon --dry-run
21+
- id: release_version
22+
if: success()
23+
run: echo ::set-output name=release_version::${GITHUB_REF:11}
24+
- name: Create Release
25+
id: create_release
26+
if: success()
27+
uses: actions/create-release@v1
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
with:
31+
tag_name: ${{ github.ref }}
32+
release_name: Micronaut ${{ steps.release_version.outputs.release_version }}
33+
body: |
34+
Micronaut ${{ steps.release_version.outputs.release_version }}
35+
- What's New: https://docs.micronaut.io/${{ steps.release_version.outputs.release_version }}/guide/index.html#whatsNew
36+
- Issues Closed: https://github.com/micronaut-projects/micronaut-core/milestone/TODO?closed=1
37+
- Changes: https://github.com/micronaut-projects/micronaut-core/compare/1.2.x...v${{ steps.release_version.outputs.release_version }}
38+
draft: true
39+
prerelease: true
40+
- name: Upload Release
41+
if: success()
42+
id: upload-release-asset
43+
uses: actions/upload-release-asset@v1.0.1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
upload_url: ${{ steps.create_release.outputs.upload_url }}
48+
asset_path: cli/build/distributions/micronaut-${{ steps.release_version.outputs.release_version }}.zip
49+
asset_name: micronaut-${{ steps.release_version.outputs.release_version }}.zip
50+
asset_content_type: application/zip
51+
- name: SDKMan Announce
52+
if: success()
53+
run: ./gradlew sdkMinorRelease --dry-run
54+
env:
55+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
56+
GVM_SDKVENDOR_KEY: ${{ secrets.GVM_SDKVENDOR_KEY }}
57+
GVM_SDKVENDOR_TOKEN: ${{ secrets.GVM_SDKVENDOR_TOKEN }}
58+
# - name: Publish to Github Pages
59+
# if: success()
60+
# uses: micronaut-projects/micronaut-docs-deploy@master
61+
# env:
62+
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
63+
# GH_REPOSITORY: micronaut-projects/micronaut-docs
64+
# BASE_BRANCH: master
65+
# BRANCH: gh-pages
66+
# FOLDER: build/docs
67+
# BETA: true
68+
# VERSION: ${{ steps.release_version.outputs.release_version }}
69+
- name: Synchronize Maven Central
70+
if: success()
71+
env:
72+
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
73+
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
74+
run: ./gradlew sWMC --dry-run

.travis.yml

-46
This file was deleted.

GRAAL.md

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Test Micronaut and GraalVM
2+
3+
The problem we want to solve is detect regressions in both Micronaut and GraalVM as soon as they are introduced and
4+
before a new version is released.
5+
6+
## Gitlab CI
7+
8+
We use [Gitlab CI](https://about.gitlab.com/product/continuous-integration/) for running the tests. Travis is not used because of the limitations it creates on memory usage and the lack of functionality for pipeline-like flows.
9+
10+
We could configure the CI pipeline to run the tests for every commit in Micronaut (configuring a webhook), but we don't
11+
have permissions to configure the webhook in GraalVM repository. So, instead of running all the tests for every commit
12+
there is a scheduled job that runs every hour and checks if there are new commits in both repositories. In case there
13+
are new commits, it triggers a CI build.
14+
15+
All the configuration is in [this repository](https://gitlab.com/micronaut-projects/micronaut-graal-tests-scheduler) and
16+
the README explains how it works. We don't need to modify this repository because everything is already setup. The only
17+
change that needs to be done is defining the Micronaut branch we monitor for new commits
18+
[here](https://gitlab.com/micronaut-projects/micronaut-graal-tests-scheduler/blob/master/should-trigger-the-build.sh#L3).
19+
20+
### CI pipeline
21+
22+
The main repository that is contains all the CI configuration and that is triggered is https://gitlab.com/micronaut-projects/micronaut-graal-tests.
23+
24+
The CI pipeline is configured in four stages:
25+
26+
- `log-commits`: It only contains one job that logs the previous Micronaut and Graal commits and the new that triggered
27+
the build.
28+
- `build-graal`: One job that clones GraalVM repository and builds it from source code.
29+
- `micronaut`: It contains one job per test application. These are Micronaut applications build with GraalVM that we
30+
know are compatible and work with GraalVM. Every job builds the native-image for the associated application.
31+
- `test`: There is one job per test application. Every job starts the native-image created in the previous stage, run
32+
some functional tests and checks the result.
33+
34+
#### Log commits stage
35+
36+
```yaml
37+
log-commits:
38+
image: alpine:3.8
39+
stage: log-commits
40+
script:
41+
- ./log-commits.sh # <1>
42+
```
43+
1.- Execute the script to log the commits. An example of the job execution can be found
44+
[here](https://gitlab.com/micronaut-projects/micronaut-graal-tests/-/jobs/353511757).
45+
46+
#### Build Graal stage
47+
48+
```yaml
49+
build-graal:
50+
stage: build-graal
51+
cache:
52+
key: ${GRAAL_LAST_COMMIT} # <1>
53+
paths:
54+
- $CI_PROJECT_DIR/graal/graal/sdk # <1>
55+
- $CI_PROJECT_DIR/graal/graal/vm # <1>
56+
artifacts:
57+
expire_in: 5 days # <2>
58+
paths:
59+
- $CI_PROJECT_DIR/graal/graal/sdk # <3>
60+
- $CI_PROJECT_DIR/graal/graal/vm # <3>
61+
script:
62+
- if [ -d $CI_PROJECT_DIR/graal ]; then exit 0; fi # <4>
63+
- ./build-graal.sh # <5>
64+
```
65+
1.- Use the GraalVM commit as a cache key. This allows to reuse the same GraalVM built from source code if it hasn't
66+
change. The `paths` defined are the output of GraalVM compilation.
67+
2.- Define an `artifact` that is passed to the next stages and it expires automatically after 5 days. Gitlab CI will
68+
save it and the artifact will be available for the jobs in the next stage. With this the JDK we just built is available
69+
to create Micronaut native-images.
70+
3.- The `paths` for the artifact are the same as in the `cache`.
71+
4.- If the cache is present then exit the built and let the rest of the pipeline continue.
72+
5.- If not, build GraalVM from source code.
73+
74+
75+
#### Micronaut Stage
76+
77+
The structure of all the jobs in this stage is the same:
78+
79+
```yaml
80+
.micronaut:build-template: &micronaut-build-template # <1>
81+
stage: micronaut
82+
artifacts:
83+
expire_in: 5 days
84+
allow_failure: true
85+
retry:
86+
max: 2
87+
when:
88+
- runner_system_failure
89+
90+
micronaut:build-basic-app:
91+
<<: *micronaut-build-template # <2>
92+
artifacts:
93+
paths:
94+
- $CI_PROJECT_DIR/micronaut-basic-app/basic-app # <3>
95+
script:
96+
- ./build-micronaut-basic-app.sh # <4>
97+
```
98+
1.- Common template for all jobs in `micronaut` stage.
99+
2.- Apply the common template.
100+
3.- Define the native-image executable as an `artifact` so it is available in the next stage for the test.
101+
4.- Execute the script to build the native-image for the test application.
102+
103+
#### Test stage
104+
105+
```yaml
106+
.micronaut:test-template: &micronaut-test-template # <1>
107+
stage: test
108+
image: frolvlad/alpine-glibc # <2>
109+
110+
micronaut:test-basic-app:
111+
<<: *micronaut-test-template # <3>
112+
dependencies:
113+
- micronaut:build-basic-app # <4>
114+
script:
115+
- ./test-basic-app.sh # <5>
116+
```
117+
1.- Common template for all jobs in `test` stage.
118+
2.- We use `frolvlad/alpine-glibc` Docker image to run the native-image applications.
119+
3.- Apply the common template.
120+
4.- This job depends on the previous one in the `micronaut` stage.
121+
5.- Execute the script to run the functional tests.
122+
123+
#### More information
124+
125+
For more information about Gitlab CI see https://docs.gitlab.com/ee/ci/.
126+
127+
128+
### Test applications
129+
130+
The tests applications are in the Github organization [micronaut-graal-tests](https://github.com/micronaut-graal-tests).
131+
All the applications have the same structure and they test different Micronaut integrations that we know work properly
132+
with GraalVM.
133+
All the test applications:
134+
- Use the latest snapshot Micronaut version. It's important that this version is for the same branch defined in
135+
["scheduler" repository](https://gitlab.com/micronaut-projects/micronaut-graal-tests-scheduler/blob/master/should-trigger-the-build.sh#L3).
136+
Check [this](https://github.com/micronaut-graal-tests/micronaut-basic-app/blob/master/gradle.properties#L1).
137+
- Provide a `build-native-image.sh` script to create the native image. This script is executed in the `micronaut` stage.
138+
More info [here](https://github.com/micronaut-graal-tests/micronaut-basic-app/blob/master/build-native-image.sh).
139+
140+
141+
## Add a new Micronaut test application
142+
143+
These are the steps to add a new Micronaut-GraalVM test application to the pipeline:
144+
145+
- Create the new test application reposiory in https://github.com/micronaut-graal-tests. Make sure that it uses the
146+
latest Micronaut.
147+
snapshot and it provides the script `build-native-image.sh` as explained before.
148+
- Add a README with the curl endpoints needed to test the application.
149+
- Create a new branch in https://gitlab.com/micronaut-projects/micronaut-graal-tests and modify `gitlab-ci.yml` file:
150+
- Add the jobs for the new application in `micronaut` and `test` stages.
151+
- Create the scripts to build the native-image for the micronaut application and for the tests. If the application
152+
needs a Docker dependency make sure it is configured properly and there is an specific `application.yml` file with
153+
the configuration. Check [gitlab-ci.yml configuration](https://gitlab.com/micronaut-projects/micronaut-graal-tests/blob/198e827338a99a06bf89ce06bafdcf72183b9663/.gitlab-ci.yml#L230-232)
154+
and an example, for example for [RabbitMQ](https://gitlab.com/micronaut-projects/micronaut-graal-tests/blob/198e827338a99a06bf89ce06bafdcf72183b9663/application-micronaut-rabbitmq-graal.yml).
155+
- Comment out the other jobs in those stages so they are not executed and we don't waste time running them.
156+
- Modify the GraalVM cache key with a value of a previous run. We do this to avoid building GraalVM for this
157+
particular branch and again waste time on something that we now it works.
158+
- Push the branch and wait for the build.
159+
- If it fails fix it.
160+
- Once it pass cherry-pick the commit that adds the new application into `master` branch, push it and delete the
161+
branch created for the application.

0 commit comments

Comments
 (0)