Skip to content

Commit 03ed165

Browse files
author
bot
committed
Merge branch 'release/v1.2.0'
2 parents 4596d86 + 9f6096f commit 03ed165

File tree

11 files changed

+260
-95
lines changed

11 files changed

+260
-95
lines changed
Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
name: Build and push
1+
name: "Build and push"
22

33
on:
44
push:
55
branches:
66
- main
77
- develop
8+
- release/*
89
pull_request:
910
branches:
1011
- main
@@ -13,40 +14,35 @@ on:
1314
jobs:
1415
build:
1516
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
java: [ '21' ]
19-
2017
steps:
2118

2219
- name: Checkout
2320
uses: actions/checkout@v4
2421
with:
2522
fetch-depth: 0
2623

27-
- name: Login to GitLab
24+
- name: Docker - Login
2825
uses: docker/login-action@v3
26+
if: ${{ github.actor != 'dependabot[bot]' }}
2927
with:
3028
username: ${{ secrets.DOCKER_USERNAME }}
3129
password: ${{ secrets.DOCKER_PASSWORD }}
3230

33-
- name: Setup Java
31+
- name: Setup - Java
3432
uses: actions/setup-java@v4
3533
with:
3634
distribution: 'temurin'
37-
java-version: ${{ matrix.java }}
35+
java-version: '21'
3836
cache: 'maven'
3937

38+
- name: Build
39+
run: mvn --batch-mode --update-snapshots clean verify spring-boot:build-image
40+
4041
- name: Spotless
4142
run: mvn spotless:check
4243

43-
- name: Build with Maven
44-
run: mvn clean verify spring-boot:build-image
45-
46-
- name: Build and push
44+
- name: Docker - Push
4745
if: ${{ github.ref == 'refs/heads/main' }}
4846
run: |
4947
VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
50-
echo ${VERSION}
5148
docker push ehrbase/migration-tool:${VERSION}
52-

.github/workflows/release.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Create a Release
2+
name: "Release"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: "optional: version to release"
9+
required: false
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
# This will be used by git in all further steps
20+
# We need a PERSONAL ACCESS TOKEN so pushes trigger other GitHub actions
21+
token: ${{ secrets.BOT_ACCESS_TOKEN }}
22+
23+
- name: Calculate realise version
24+
run: |
25+
if [ -z "${{ github.event.inputs.version }}" ]
26+
then
27+
v=$(grep -oPm1 "(?<=<version>)[^<]+" "pom.xml" | sed 's/-SNAPSHOT//')
28+
echo ${{ github.repository }}
29+
else
30+
v=${{ github.event.inputs.version }}
31+
fi
32+
echo "realise version ${v}"
33+
# Set as Environment for all further steps
34+
echo "VERSION=${v}" >> $GITHUB_ENV
35+
36+
- name: Create Release Branch
37+
run: |
38+
# Config git
39+
git config --global user.email "bot@ehrbase.org"
40+
git config --global user.name "bot"
41+
# create branch
42+
git checkout -b release/v${VERSION}
43+
# Update version
44+
mvn versions:set -DnewVersion=${VERSION} -DprocessAllModules=true
45+
#edit changelog
46+
replace="s/\[unreleased\]/\[${VERSION}\]/"
47+
sed -i ${replace} CHANGELOG.md
48+
replace="s/...HEAD/\...v${VERSION}/"
49+
sed -i ${replace} CHANGELOG.md
50+
# commit & push
51+
git add -A
52+
git commit -m "release ${VERSION}: updated version to ${VERSION}"
53+
git push -u origin release/v${VERSION}
54+
# wait for status of commit to change from pending
55+
- name: Wait for ci pipeline
56+
run: |
57+
STATUS="pending"
58+
# Get commit last commit of release branch
59+
COMMIT=$(git rev-parse HEAD)
60+
echo "Listen for commit $COMMIT"
61+
WAITED="0"
62+
# Time between calls
63+
SLEEP_TIME="60"
64+
while [ "$STATUS" == "pending" ] && [ "$WAITED" -le 1800 ]
65+
do
66+
sleep ${SLEEP_TIME}
67+
WAITED=$((WAITED+SLEEP_TIME))
68+
STATUS=$(gh api /repos/${{ github.repository }}/commits/"${COMMIT}"/status -q .state)
69+
echo "status : $STATUS"
70+
echo "waited $WAITED s"
71+
done
72+
echo "status : $STATUS"
73+
if [ "$STATUS" != "success" ]
74+
then exit 1
75+
fi
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
78+
79+
- name: Merge into Main
80+
run: |
81+
git checkout main
82+
git pull
83+
git merge --no-ff release/v${VERSION}
84+
git tag -a -m "v${VERSION}" "v${VERSION}"
85+
git push --follow-tags
86+
87+
- name: Create Release
88+
run: |
89+
gh release create "v${VERSION}" -t "v${VERSION}" -F CHANGELOG.md -R ${{ github.repository }} --target main
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
92+
93+
- name: Merge into dev
94+
run: |
95+
# increment minor version and add SNAPSHOT
96+
ARRAY_VERSION=( ${VERSION//./ } )
97+
git checkout release/v${VERSION}
98+
NEXT_VERSION=${ARRAY_VERSION[0]}.$((ARRAY_VERSION[1]+1)).0-SNAPSHOT
99+
echo "next version: $NEXT_VERSION"
100+
# update version
101+
mvn versions:set -DnewVersion=${NEXT_VERSION} -DprocessAllModules=true
102+
#edit changelog
103+
sed -i '5i ## [unreleased]\n ### Added \n ### Fixed \n' CHANGELOG.md
104+
replace="$ a \[unreleased\]: https:\/\/github.com\/ehrbase\/openEHR_SDK\/compare\/v$VERSION...HEAD"
105+
sed -i "${replace}" CHANGELOG.md
106+
git add -A
107+
git commit -m " updated version to ${NEXT_VERSION}"
108+
git checkout develop
109+
git pull
110+
git merge --no-ff release/v${VERSION}
111+
git push
112+
113+

.github/workflows/status.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Adds the results of a workflow as a commit status
2+
name: "Set test status"
3+
4+
on:
5+
workflow_run:
6+
workflows: ["Build and push"] # runs after build and test workflow
7+
types:
8+
- completed
9+
10+
jobs:
11+
set_status:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
statuses: write
15+
steps:
16+
- name: Create status
17+
run: |
18+
gh api repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_commit.id }} \
19+
-f "state"="${{ github.event.workflow_run.conclusion }}" \
20+
-f "context"="${{ github.event.workflow_run.event }}.${{ github.event.workflow_run.id}}"\
21+
-f "target_url"="${{ github.event.workflow_run.html_url }}"
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
6+
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.2.0]
9+
### Fixed
10+
11+
- Fix class not found [[#9](https://github.com/ehrbase/migration-tool/pull/9)]
12+
13+
## [1.1.0]
14+
15+
Initial publicly available version.
16+
17+
[1.2.0]: https://github.com/ehrbase/migration-tool/compare/v1.1.0...v1.2.0

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ The target database needs to be prepared according to the instructions in the [E
1919

2020
## Performing the migration
2121

22-
The migration can be run directly from the source code, or the provided docker image.
22+
The migration can be run directly from the source code, or the provided docker image. As a naming convention an `export`
23+
datasource represents an EHRbase 0.x.x database where an `import` datasource represents an EHRbase 2 database.
24+
2325
The properties must be adjusted according to the set-up:
2426

2527
### Spring boot
@@ -28,10 +30,10 @@ mvn package
2830
2931
java -jar application/target/migration-tool.jar \
3032
-Dmode=DB2DB \
31-
-Dspring.datasource.import.url=jdbc:postgresql://localhost:5432/ehrbase_import \
33+
-Dspring.datasource.import.url=jdbc:postgresql://localhost:5432/ehrbase_new \
3234
-Dspring.datasource.import.username=ehrbase \
3335
-Dspring.datasource.import.password=ehrbase \
34-
-Dspring.datasource.export.url=jdbc:postgresql://localhost:5432/ehrbase_export \
36+
-Dspring.datasource.export.url=jdbc:postgresql://localhost:5432/ehrbase_old \
3537
-Dspring.datasource.export.username=ehrbase \
3638
-Dspring.datasource.export.password=ehrbase \
3739
-Dimport.ehrbase-db-user=ehrbase_restricted
@@ -43,10 +45,10 @@ mvn verify
4345
4446
docker run ehrbase/migration-tool:1.1.0 \
4547
-e mode=DB2DB \
46-
-e spring.datasource.import.url=jdbc:postgresql://localhost:5432/ehrbase_import \
48+
-e spring.datasource.import.url=jdbc:postgresql://localhost:5432/ehrbase_new \
4749
-e spring.datasource.import.username=ehrbase \
4850
-e spring.datasource.import.password=ehrbase \
49-
-e spring.datasource.export.url=jdbc:postgresql://localhost:5432/ehrbase_export \
51+
-e spring.datasource.export.url=jdbc:postgresql://localhost:5432/ehrbase_old \
5052
-e spring.datasource.export.username=ehrbase \
5153
-e spring.datasource.export.password=ehrbase \
5254
-e import.ehrbase-db-user=ehrbase_restricted

application/pom.xml

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@
1111

1212
<groupId>org.ehrbase.migration</groupId>
1313
<artifactId>migration-application</artifactId>
14-
<version>1.1.0</version>
14+
<version>1.2.0</version>
1515
<packaging>jar</packaging>
1616
<name>EHRbase Migration Tool Application</name>
1717

1818
<properties>
19-
<image.name>ehrbase/migration-tool</image.name>
20-
<image.tag>${project.version}</image.tag>
2119
<maven.compiler.source>21</maven.compiler.source>
2220
<maven.compiler.target>21</maven.compiler.target>
2321
<java.version>21</java.version>
22+
23+
<skipTests>false</skipTests>
24+
25+
<image.name>ehrbase/migration-tool</image.name>
26+
<image.tag>${project.version}</image.tag>
2427
</properties>
2528

2629
<dependencyManagement>
@@ -35,14 +38,16 @@
3538
</dependencies>
3639
</dependencyManagement>
3740

38-
3941
<dependencies>
4042

43+
<!-- Compile -->
4144
<dependency>
4245
<groupId>org.ehrbase.migration</groupId>
4346
<artifactId>migration-service</artifactId>
4447
<version>${project.version}</version>
4548
</dependency>
49+
50+
<!-- Test -->
4651
<dependency>
4752
<groupId>org.springframework.boot</groupId>
4853
<artifactId>spring-boot-starter-test</artifactId>
@@ -55,6 +60,10 @@
5560
<groupId>org.wiremock</groupId>
5661
<artifactId>wiremock</artifactId>
5762
</dependency>
63+
<dependency>
64+
<groupId>org.mock-server</groupId>
65+
<artifactId>mockserver-junit-jupiter</artifactId>
66+
</dependency>
5867
<dependency>
5968
<groupId>io.jsonwebtoken</groupId>
6069
<artifactId>jjwt-impl</artifactId>
@@ -63,14 +72,11 @@
6372
<groupId>io.jsonwebtoken</groupId>
6473
<artifactId>jjwt-jackson</artifactId>
6574
</dependency>
66-
<dependency>
67-
<groupId>org.mock-server</groupId>
68-
<artifactId>mockserver-junit-jupiter</artifactId>
69-
</dependency>
7075
<dependency>
7176
<groupId>com.nimbusds</groupId>
7277
<artifactId>nimbus-jose-jwt</artifactId>
7378
</dependency>
79+
7480
</dependencies>
7581

7682
<build>
@@ -85,6 +91,18 @@
8591
</compilerArgs>
8692
</configuration>
8793
</plugin>
94+
<plugin>
95+
<groupId>org.apache.maven.plugins</groupId>
96+
<artifactId>maven-jar-plugin</artifactId>
97+
<version>3.3.0</version>
98+
<executions>
99+
<execution>
100+
<goals>
101+
<goal>test-jar</goal>
102+
</goals>
103+
</execution>
104+
</executions>
105+
</plugin>
88106
<plugin>
89107
<groupId>com.diffplug.spotless</groupId>
90108
<artifactId>spotless-maven-plugin</artifactId>
@@ -132,6 +150,7 @@
132150
<skip>false</skip>
133151
</configuration>
134152
</plugin>
153+
135154
<plugin>
136155
<groupId>org.jacoco</groupId>
137156
<artifactId>jacoco-maven-plugin</artifactId>
@@ -172,12 +191,21 @@
172191
<goals>
173192
<goal>test</goal>
174193
</goals>
194+
<configuration>
195+
<skipTests>${skipTests}</skipTests>
196+
<includes>
197+
<include>**/*Test.java</include>
198+
</includes>
199+
</configuration>
175200
</execution>
176201
</executions>
177202
</plugin>
178203
<plugin>
179204
<groupId>org.apache.maven.plugins</groupId>
180205
<artifactId>maven-failsafe-plugin</artifactId>
206+
<configuration>
207+
<skipITs>${skipTests}</skipITs>
208+
</configuration>
181209
<executions>
182210
<execution>
183211
<id>integration-test</id>
@@ -196,19 +224,6 @@
196224
</execution>
197225
</executions>
198226
</plugin>
199-
200-
<plugin>
201-
<groupId>org.apache.maven.plugins</groupId>
202-
<artifactId>maven-jar-plugin</artifactId>
203-
<version>3.3.0</version>
204-
<executions>
205-
<execution>
206-
<goals>
207-
<goal>test-jar</goal>
208-
</goals>
209-
</execution>
210-
</executions>
211-
</plugin>
212227
</plugins>
213228
</build>
214229

0 commit comments

Comments
 (0)