Skip to content

Commit 41b14b6

Browse files
Henrik Adamskifegbers
Henrik Adamski
andauthored
LIBS-1052 - Update dependencies and MongoDB docker image (#17)
* LIBS-1052 - Update dependencies and MongoDB docker image * LIBS-1052 - Update LICENSE * LIBS-1052 - further updates Co-authored-by: fegbers <[email protected]>
1 parent 5659b52 commit 41b14b6

File tree

9 files changed

+166
-29
lines changed

9 files changed

+166
-29
lines changed

.github/workflows/nightly.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# This configuration is used for nightly builds
12
name: nightly
23

34
on:
45
schedule:
5-
- cron: 0 0 * * 1
6+
# Runs every Monday at 00:00
7+
- cron: 0 0 * * MON
68

79
jobs:
810
nightly:
@@ -11,30 +13,45 @@ jobs:
1113
runs-on: ubuntu-latest
1214

1315
steps:
16+
# Setup java environment
1417
- name: setup-java
1518
uses: actions/setup-java@v1
1619
with:
1720
java-version: 11
1821

22+
# Checkout the git repository
1923
- name: checkout
2024
uses: actions/checkout@v2
25+
with:
26+
ref: ${{ github.head_ref }}
27+
token: ${{ secrets.GPR_TOKEN }}
28+
fetch-depth: ''
29+
30+
# Execute some necessary git commands to get more repository informations
31+
- name: post-checkout
32+
run: git fetch --prune --unshallow
2133

34+
# Setup/load GitHub Actions caching for external dependencies, in this case especially for Maven
2235
- name: caching
2336
uses: actions/cache@v2
2437
with:
2538
path: ~/.m2/repository
2639
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2740
restore-keys: ${{ runner.os }}-maven-
2841

42+
# Execute Maven command for compile and compile of the tests
2943
- name: compile
3044
run: mvn clean compile test-compile
3145

46+
# Execute Unit tests
3247
- name: unit-tests
3348
run: mvn surefire:test
3449

50+
# Execute Integration tests, in this case we can skip the unit tests and load these with jacoco
3551
- name: integration-tests
3652
run: mvn -DskipUTs -Dgpg.skip=true jacoco:restore-instrumented-classes verify
3753

54+
# Execute sonar analysis and publish results to the sonarqube server
3855
- name: sonar-analyse
3956
env:
4057
SONAR_HOST: ${{ secrets.OS_SONAR_HOST_URL }}

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# This configuration is used for the deployment and publish to GitHub Packages
12
name: release
23

34
on:
45
push:
56
branches:
7+
# Runs only on push to the master branch
68
- master
79

810
jobs:
@@ -15,6 +17,7 @@ jobs:
1517
runs-on: ubuntu-latest
1618

1719
steps:
20+
# Setup java environment
1821
- name: setup-java
1922
uses: actions/setup-java@v1
2023
with:
@@ -23,31 +26,45 @@ jobs:
2326
server-username: OSSRH_USERNAME
2427
server-password: OSSRH_PASSWORD
2528

29+
# Checkout the git repository
2630
- name: setup-github-release
2731
run: sed -i -e 's/<\/servers>/<server><id>github<\/id><username>x-access-token<\/username><password>${GITHUB_TOKEN}<\/password><\/server><\/servers>/g' /home/runner/.m2/settings.xml
2832

33+
# Setup GPG for Maven Central deployment
2934
- name: setup-gpg
3035
env:
3136
GPG_PRIVATE_KEY: ${{ secrets.OS_GPG_PRIVATE_KEY }}
3237
run: cat <(echo -e "${GPG_PRIVATE_KEY}") | gpg --batch --import
3338

39+
# Checkout the git repository
3440
- name: checkout
3541
uses: actions/checkout@v2
42+
with:
43+
ref: ${{ github.head_ref }}
44+
token: ${{ secrets.GPR_TOKEN }}
45+
fetch-depth: ''
46+
47+
# Execute some necessary git commands to get more repository informations
48+
- name: post-checkout
49+
run: git fetch --prune --unshallow
3650

51+
# Setup GitHub Actions caching for external dependencies, in this case especially for Maven
3752
- name: caching
3853
uses: actions/cache@v2
3954
with:
4055
path: ~/.m2/repository
4156
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
4257
restore-keys: ${{ runner.os }}-maven-
4358

59+
# Execute Maven command for the deployment and publish to Maven Central
4460
- name: deploy
4561
env:
4662
OSSRH_USERNAME: ${{ secrets.OS_OSSRH_USERNAME }}
4763
OSSRH_PASSWORD: ${{ secrets.OS_OSSRH_PASSWORD }}
4864
GPG_PASSPHRASE: ${{ secrets.OS_GPG_PASSPHRASE }}
4965
run: mvn deploy -Dmaven.wagon.http.pool=false -Dgpg.executable=gpg -Dgpg.passphrase=${GPG_PASSPHRASE}
5066

67+
# Execute sonar analysis and publish results to the sonarcloud server
5168
- name: sonar-analyse
5269
env:
5370
SONAR_HOST: ${{ secrets.OS_SONAR_HOST_URL }}
@@ -60,3 +77,35 @@ jobs:
6077
-Dsonar.organization=${SONAR_ORGANIZATION} \
6178
-Dsonar.projectKey=${GITHUB_REPOSITORY//\//_} \
6279
-Dsonar.java.binaries=./target/classes
80+
81+
# Get the current project version from POM
82+
- name: get-project-version
83+
id: get_project_version
84+
uses: avides/actions-project-version-check@v1
85+
with:
86+
token: ${{ secrets.GITHUB_TOKEN }}
87+
file-to-check: pom.xml
88+
only-return-version: true
89+
90+
# Get last commit message for GitHub Release tag
91+
- name: setup-github-release
92+
id: setup_github_release
93+
env:
94+
PROJECT_VERSION: ${{ steps.get_project_version.outputs.version }}
95+
run: |
96+
echo ::set-output name=gitcommitmessage::$(git log --no-merges -1 --oneline)
97+
if [[ "$PROJECT_VERSION" == *"SNAPSHOT"* || "$PROJECT_VERSION" == *"RC"* ]]; then
98+
echo ::set-output name=isprerelease::true
99+
fi
100+
101+
# Create and publish GitHub Release tag
102+
- name: github-release
103+
uses: actions/create-release@v1
104+
continue-on-error: true
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GPR_TOKEN }}
107+
with:
108+
tag_name: ${{ steps.get_project_version.outputs.version }}
109+
release_name: ${{ steps.get_project_version.outputs.version }}
110+
body: ${{ steps.setup_github_release.outputs.gitcommitmessage }}
111+
prerelease: ${{ steps.setup_github_release.outputs.isprerelease }}

.github/workflows/review.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
# This configuration is used for the pull request review
12
name: review
23

34
on:
45
pull_request:
6+
# Runs only on pull request creation and on every new commit to the created pull request
57
types: [opened, synchronize]
68

79
jobs:
@@ -11,37 +13,95 @@ jobs:
1113
runs-on: ubuntu-latest
1214

1315
steps:
16+
# Cancels previous run for this branch that have a different commit id (SHA)
17+
- name: cancel-previous-run
18+
uses: styfle/[email protected]
19+
with:
20+
access_token: ${{ github.token }}
21+
22+
# Setup java environment
1423
- name: setup-java
1524
uses: actions/setup-java@v1
1625
with:
1726
java-version: 11
1827

28+
# Checkout the git repository
1929
- name: checkout
2030
uses: actions/checkout@v2
31+
with:
32+
ref: ${{ github.head_ref }}
33+
token: ${{ secrets.GPR_TOKEN }}
34+
fetch-depth: ''
35+
36+
# Execute some necessary git commands to get more repository informations
37+
- name: post-checkout
38+
run: git fetch --prune --unshallow
2139

40+
# Update GitHub Action configuration if necessary
41+
- name: action-configuration-autoupdate
42+
uses: avides/actions-action-configuration-autoupdate@v1
43+
with:
44+
token: ${{ secrets.GPR_TOKEN }}
45+
actions-configuration-files: os-java-library/nightly.yml,os-java-library/release.yml,os-java-library/review.yml
46+
source-repository: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_REPO }}
47+
48+
# Push updated GitHub Actions configuration if necessary
49+
- uses: stefanzweifel/git-auto-commit-action@v4
50+
with:
51+
file_pattern: .github/workflows/*.yml
52+
commit_user_name: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_USER }}
53+
commit_user_email: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_EMAIL }}
54+
commit_author: ${{ secrets.ACTIONS_CONFIG_AUTOUPDATE_AUTHOR }}
55+
commit_message: Update GitHub Action configuration
56+
57+
# Verify project version is updated
2258
- name: project-version-check
2359
uses: avides/actions-project-version-check@v1
2460
with:
2561
token: ${{ secrets.GITHUB_TOKEN }}
2662
file-to-check: pom.xml
2763
additional-files-to-check: README.md
2864

65+
# Check if documentation reminder comment is already given
66+
- name: find-documentation-reminder-comment
67+
uses: peter-evans/find-comment@v1
68+
id: find_documentation_reminder_comment
69+
with:
70+
issue-number: ${{ github.event.number }}
71+
body-includes: "Confluence/GitHub documentation added or updated?"
72+
73+
# Add documentation reminder comment if not given
74+
- name: documentation-reminder-comment
75+
uses: jungwinter/comment@v1
76+
id: create
77+
if: ${{ steps.find_documentation_reminder_comment.outputs.comment-id == 0 }}
78+
with:
79+
type: create
80+
body: 'Confluence/GitHub documentation added or updated?'
81+
issue_number: ${{ github.event.number }}
82+
token: ${{ secrets.GITHUB_TOKEN }}
83+
84+
# Setup/load GitHub Actions caching for external dependencies, in this case especially for Maven
2985
- name: caching
3086
uses: actions/cache@v2
3187
with:
3288
path: ~/.m2/repository
3389
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
3490
restore-keys: ${{ runner.os }}-maven-
3591

92+
# Execute Maven command for compile and compile of the tests
3693
- name: compile
3794
run: mvn clean compile test-compile
3895

96+
# Execute Unit tests
3997
- name: unit-tests
4098
run: mvn surefire:test
4199

100+
# Execute Integration tests, in this case we can skip the unit tests and load these with jacoco
42101
- name: integration-tests
43102
run: mvn -DskipUTs -Dgpg.skip=true jacoco:restore-instrumented-classes verify
44103

104+
# Execute sonar analysis for current branch
45105
- name: sonar-analyse
46106
env:
47107
SONAR_HOST: ${{ secrets.OS_SONAR_HOST_URL }}
@@ -56,8 +116,10 @@ jobs:
56116
-Dsonar.projectKey=${GITHUB_REPOSITORY//\//_} \
57117
-Dsonar.pullrequest.key=${{ github.event.number }} \
58118
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} \
119+
-Dsonar.pullrequest.github.repository=${GITHUB_REPOSITORY} \
59120
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} \
60121
-Dsonar.java.binaries=./target/classes
61122
123+
# Execute Maven enforcer plugin
62124
- name: pom-analyse
63125
run: mvn enforcer:enforce

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 springtainer
3+
Copyright (c) 2022 springtainer
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,41 @@
88
[![Technical dept](https://sonarcloud.io/api/project_badges/measure?project=springtainer_springtainer-mongodb&metric=sqale_index)](https://sonarcloud.io/dashboard?id=springtainer_springtainer-mongodb)
99

1010
### Dependency
11+
1112
```xml
13+
1214
<dependency>
13-
<groupId>com.avides.springboot.springtainer</groupId>
14-
<artifactId>springtainer-mongodb</artifactId>
15-
<version>1.2.0</version>
16-
<scope>test</scope>
15+
<groupId>com.avides.springboot.springtainer</groupId>
16+
<artifactId>springtainer-mongodb</artifactId>
17+
<version>1.3.0</version>
18+
<scope>test</scope>
1719
</dependency>
1820
```
1921

2022
### Configuration
23+
2124
Properties consumed (in `bootstrap.properties`):
25+
2226
- `embedded.container.mongodb.enabled` (default is `true`)
2327
- `embedded.container.mongodb.startup-timeout` (default is `30`)
24-
- `embedded.container.mongodb.docker-image` (default is `mongo:4.0.18`)
28+
- `embedded.container.mongodb.docker-image` (default is `mongo:4.0.28`)
2529
- `embedded.container.mongodb.port` (default is `27017`)
2630

2731
Properties provided (in `application-it.properties`):
32+
2833
- `embedded.container.mongodb.host`
2934
- `embedded.container.mongodb.port`
3035

3136
Example for minimal configuration in `application-it.properties`:
37+
3238
```
3339
spring.data.mongodb.uri=mongodb://${embedded.container.mongodb.host}:${embedded.container.mongodb.port}/test
3440
```
3541

3642
## Logging
43+
3744
To reduce logging insert this into the logback-configuration:
45+
3846
```xml
3947
<!-- Springtainer -->
4048
<logger name="com.github.dockerjava.jaxrs" level="WARN" />
@@ -43,7 +51,9 @@ To reduce logging insert this into the logback-configuration:
4351
```
4452

4553
## Labels
54+
4655
The container exports multiple labels to analyze running springtainers:
56+
4757
- `SPRINGTAINER_SERVICE=mongodb`
4858
- `SPRINGTAINER_IMAGE=${embedded.container.mongodb.docker-image}`
4959
- `SPRINGTAINER_STARTED=$currentTimestamp`

pom.xml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>com.avides.springboot.springtainer</groupId>
55
<artifactId>springtainer-mongodb</artifactId>
6-
<version>1.2.0</version>
6+
<version>1.3.0</version>
77

88
<name>springtainer-mongodb</name>
99
<description>MongoDB test-container</description>
@@ -41,31 +41,30 @@
4141
<!-- Build -->
4242
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
4343
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
44-
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
45-
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
46-
<maven-surefire-plugin.version>3.0.0-M4</maven-surefire-plugin.version>
47-
<maven-failsafe-plugin.version>3.0.0-M4</maven-failsafe-plugin.version>
44+
<maven-javadoc-plugin.version>3.3.0</maven-javadoc-plugin.version>
45+
<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
46+
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
47+
<maven-failsafe-plugin.version>3.0.0-M5</maven-failsafe-plugin.version>
4848
<maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
49-
<maven-release-plugin.version>3.0.0-M1</maven-release-plugin.version>
49+
<maven-release-plugin.version>3.0.0-M5</maven-release-plugin.version>
5050
<maven-scm-provider-gitexe.version>1.11.2</maven-scm-provider-gitexe.version>
51-
<exists-maven-plugin.version>0.3.0</exists-maven-plugin.version>
51+
<exists-maven-plugin.version>0.6.0</exists-maven-plugin.version>
5252
<github-release-plugin.version>1.4.0</github-release-plugin.version>
5353
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
5454
<!-- Spring -->
55-
<spring.version>5.2.7.RELEASE</spring.version>
56-
<spring-boot.version>2.3.1.RELEASE</spring-boot.version>
55+
<spring.version>5.3.15</spring.version>
56+
<spring-boot.version>2.6.3</spring-boot.version>
5757
<!-- Other -->
58-
<springtainer-common.version>1.2.0</springtainer-common.version>
59-
<lombok.version>1.18.12</lombok.version>
60-
<spring-data-mongodb.version>3.0.1.RELEASE</spring-data-mongodb.version>
61-
<mongo-java-driver.version>3.12.5</mongo-java-driver.version>
58+
<springtainer-common.version>1.3.1</springtainer-common.version>
59+
<lombok.version>1.18.22</lombok.version>
60+
<spring-data-mongodb.version>3.3.1</spring-data-mongodb.version>
61+
<mongodb-driver-sync.version>4.4.1</mongodb-driver-sync.version>
6262
<!-- Testing -->
63-
<jacoco.version>0.8.5</jacoco.version>
64-
<powermock.version>2.0.7</powermock.version>
65-
<easymock.version>4.2</easymock.version>
66-
<assertj-core.version>3.16.1</assertj-core.version>
67-
<logback-classic.version>1.2.3</logback-classic.version>
68-
<mongodb-driver-sync.version>4.0.4</mongodb-driver-sync.version>
63+
<jacoco.version>0.8.7</jacoco.version>
64+
<powermock.version>2.0.9</powermock.version>
65+
<easymock.version>4.3</easymock.version>
66+
<assertj-core.version>3.22.0</assertj-core.version>
67+
<logback-classic.version>1.2.10</logback-classic.version>
6968
</properties>
7069

7170
<dependencies>

0 commit comments

Comments
 (0)