Skip to content

Commit 14a6dbf

Browse files
Merge branch 'develop' into 305-mavenCaching
Signed-off-by: Pascal Wilbrink <[email protected]>
2 parents f799421 + 1d3b219 commit 14a6dbf

File tree

98 files changed

+388
-1729
lines changed

Some content is hidden

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

98 files changed

+388
-1729
lines changed

.github/workflows/build-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- name: Set up Docker Buildx
3333
id: buildx
34-
uses: docker/setup-buildx-action@v2
34+
uses: docker/setup-buildx-action@v3
3535
- name: Set up JDK 17
3636
uses: actions/setup-java@v3
3737
with:

.github/workflows/release-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
cache: 'maven'
3939
- name: Set up Docker Buildx
4040
id: buildx
41-
uses: docker/setup-buildx-action@v2
41+
uses: docker/setup-buildx-action@v3
4242
- name: Login to Docker Hub
4343
uses: docker/login-action@v2
4444
with:

.github/workflows/reuse.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v3
1515
- name: REUSE Compliance Check
16-
uses: fsfe/reuse-action@v1
16+
uses: fsfe/reuse-action@v2

.github/workflows/sonarcloud-analysis.yml

Lines changed: 95 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -4,77 +4,106 @@
44

55
name: SonarCloud Analysis
66

7-
on:
8-
push:
9-
branches:
10-
- '**'
11-
pull_request:
12-
branches:
13-
- 'main'
14-
- 'develop'
15-
pull_request_target:
16-
branches:
17-
- 'main'
18-
- 'develop'
7+
on:
8+
workflow_run:
9+
workflows: [SonarCloud Build]
10+
types: [completed]
1911

2012
jobs:
2113
sonar-check:
22-
name: Sonar Check
2314
runs-on: ubuntu-latest
15+
if: github.event.workflow_run.conclusion == 'success'
2416
timeout-minutes: 15
25-
26-
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
2717
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v3
30-
with:
31-
fetch-depth: 0
32-
33-
- name: Cache SonarCloud packages
34-
uses: actions/cache@v3
35-
with:
36-
path: ~/.sonar/cache
37-
key: ${{ runner.os }}-sonar
38-
restore-keys: ${{ runner.os }}-sonar
18+
- name: echo event
19+
run: cat $GITHUB_EVENT_PATH
20+
- name: Download PR number artifact
21+
if: github.event.workflow_run.event == 'pull_request'
22+
uses: dawidd6/action-download-artifact@v2
23+
with:
24+
workflow: SonarCloud Build
25+
run_id: ${{ github.event.workflow_run.id }}
26+
name: PR_NUMBER
27+
- name: Read PR_NUMBER.txt
28+
if: github.event.workflow_run.event == 'pull_request'
29+
id: pr_number
30+
uses: juliangruber/read-file-action@v1
31+
with:
32+
path: ./PR_NUMBER.txt
33+
- name: Request GitHub API for PR data
34+
if: github.event.workflow_run.event == 'pull_request'
35+
uses: octokit/[email protected]
36+
id: get_pr_data
37+
with:
38+
route: GET /repos/{full_name}/pulls/{number}
39+
number: ${{ steps.pr_number.outputs.content }}
40+
full_name: ${{ github.event.repository.full_name }}
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
- uses: actions/checkout@v3
44+
with:
45+
repository: ${{ github.event.workflow_run.head_repository.full_name }}
46+
ref: ${{ github.event.workflow_run.head_branch }}
47+
fetch-depth: 0
48+
- name: Checkout base branch
49+
if: github.event.workflow_run.event == 'pull_request'
50+
run: |
51+
git remote add upstream ${{ github.event.repository.clone_url }}
52+
git fetch upstream
53+
git checkout -B ${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} upstream/${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
54+
git checkout ${{ github.event.workflow_run.head_branch }}
55+
git clean -ffdx && git reset --hard HEAD
56+
- name: Cache SonarCloud packages
57+
uses: actions/cache@v3
58+
with:
59+
path: ~/.sonar/cache
60+
key: ${{ runner.os }}-sonar
61+
restore-keys: ${{ runner.os }}-sonar
3962

40-
- name: Set up JDK 17
41-
uses: actions/setup-java@v3
42-
with:
43-
distribution: 'zulu'
44-
java-version: '17'
45-
cache: 'maven'
63+
- name: Cache Maven packages
64+
uses: actions/cache@v3
65+
with:
66+
path: ~/.m2
67+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
68+
restore-keys: ${{ runner.os }}-m2
4669

47-
- name: Set Common Sonar Variables
48-
id: sonar_env
49-
run: |
50-
echo "##[set-output name=sonar_opts;]$(echo -Dsonar.host.url=https://sonarcloud.io \
51-
-Dsonar.projectKey=com-pas_compas-scl-data-service \
52-
-Dsonar.organization=com-pas )"
53-
- name: Create custom Maven Settings.xml
54-
uses: whelk-io/maven-settings-xml-action@v21
55-
with:
56-
output_file: custom_maven_settings.xml
57-
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
58-
- name: Build and analyze (Pull Request)
59-
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
60-
env:
61-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
63-
run: |
64-
./mvnw -B -s custom_maven_settings.xml -Psonar \
65-
${{ steps.sonar_env.outputs.sonar_opts }} \
66-
-Dsonar.pullrequest.branch=${{ github.ref_name }} \
67-
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
68-
-Dsonar.pullrequest.base=${{ github.base_ref }} \
69-
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} \
70-
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
71-
- name: Build and analyze (Push)
72-
if: ${{ github.event_name == 'push' }}
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
76-
run: |
77-
./mvnw -B -s custom_maven_settings.xml -Psonar \
78-
${{ steps.sonar_env.outputs.sonar_opts }} \
79-
-Dsonar.branch.name=${{ github.ref_name }} \
80-
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
70+
- name: Set up JDK 17
71+
uses: actions/setup-java@v3
72+
with:
73+
distribution: 'zulu'
74+
java-version: '17'
75+
- name: Set Common Sonar Variables
76+
id: sonar_env
77+
run: |
78+
echo "##[set-output name=sonar_opts;]$(echo -Dsonar.host.url=https://sonarcloud.io \
79+
-Dsonar.projectKey=com-pas_compas-scl-data-service \
80+
-Dsonar.organization=com-pas )"
81+
- name: Create custom Maven Settings.xml
82+
uses: whelk-io/maven-settings-xml-action@v21
83+
with:
84+
output_file: custom_maven_settings.xml
85+
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
86+
- name: Build and analyze (Pull Request)
87+
if: ${{ github.event.workflow_run.event == 'pull_request' || (github.event.workflow_run.actor == 'dependabot[bot]' && github.event.workflow_run.event == 'pull_request_target') }}
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
91+
run: |
92+
./mvnw -B -s custom_maven_settings.xml -Psonar \
93+
${{ steps.sonar_env.outputs.sonar_opts }} \
94+
-Dsonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} \
95+
-Dsonar.pullrequest.key=${{ fromJson(steps.get_pr_data.outputs.data).number }} \
96+
-Dsonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} \
97+
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} \
98+
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
99+
- name: Build and analyze (Push)
100+
if: ${{ github.event.workflow_run.event == 'push' }}
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
104+
run: |
105+
./mvnw -B -s custom_maven_settings.xml -Psonar \
106+
${{ steps.sonar_env.outputs.sonar_opts }} \
107+
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} \
108+
-Dsonar.branch.name=${{ github.event.workflow_run.head_branch }} \
109+
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# SPDX-FileCopyrightText: 2022 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
name: SonarCloud Build
6+
7+
on:
8+
push:
9+
branches:
10+
- '**'
11+
pull_request:
12+
branches:
13+
- 'main'
14+
- 'develop'
15+
pull_request_target:
16+
branches:
17+
- 'main'
18+
- 'develop'
19+
20+
jobs:
21+
precheck-build:
22+
name: Pre Check Build
23+
runs-on: ubuntu-latest
24+
timeout-minutes: 30
25+
26+
if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Cache SonarCloud packages
34+
uses: actions/cache@v3
35+
with:
36+
path: ~/.sonar/cache
37+
key: ${{ runner.os }}-sonar
38+
restore-keys: ${{ runner.os }}-sonar
39+
- name: Cache Maven packages
40+
uses: actions/cache@v3
41+
with:
42+
path: ~/.m2
43+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
44+
restore-keys: ${{ runner.os }}-m2
45+
46+
- name: Set up JDK 17
47+
uses: actions/setup-java@v3
48+
with:
49+
distribution: 'zulu'
50+
java-version: '17'
51+
52+
- name: Create custom Maven Settings.xml
53+
uses: whelk-io/maven-settings-xml-action@v21
54+
with:
55+
output_file: custom_maven_settings.xml
56+
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
57+
- name: Build and analyze (Pull Request)
58+
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
run: |
62+
./mvnw -B -s custom_maven_settings.xml clean verify
63+
- name: Build and analyze (Push)
64+
if: ${{ github.event_name == 'push' }}
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
run: |
68+
./mvnw -B -s custom_maven_settings.xml clean verify
69+
- name: Save PR number to file
70+
if: github.event_name == 'pull_request'
71+
run: echo ${{ github.event.number }} > PR_NUMBER.txt
72+
- name: Archive PR number
73+
if: github.event_name == 'pull_request'
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: PR_NUMBER
77+
path: PR_NUMBER.txt

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ parts of this repository can also be used separately in your own component to ma
1919
Service Layer can be used as Java component to manage them. For more information about the architecture go
2020
to [documentation](doc/compas-scl-data-service.md).
2121

22-
There are currently two database implementations available.
22+
There is currently one database implementations available.
2323

24-
- For more development information about the BaseX Implementation go to [BaseX](doc/basex.md). (Profile activated by
25-
default.)
2624
- For more development information about the PostgreSQL Implementation go to [PostgreSQL](doc/postgresql.md).
2725

2826
> **Note:** When switching between implementation it's a good practise to first execute a maven clean to remove

app/pom.xml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ SPDX-License-Identifier: Apache-2.0
3131
<groupId>org.lfenergy.compas.scl.data</groupId>
3232
<artifactId>repository</artifactId>
3333
</dependency>
34-
<dependency>
35-
<groupId>org.lfenergy.compas.scl.data</groupId>
36-
<artifactId>repository-basex</artifactId>
37-
</dependency>
3834
<dependency>
3935
<groupId>org.lfenergy.compas.scl.data</groupId>
4036
<artifactId>repository-postgresql</artifactId>
@@ -171,28 +167,8 @@ SPDX-License-Identifier: Apache-2.0
171167
<goal>generate-code-tests</goal>
172168
</goals>
173169
</execution>
174-
<execution>
175-
<id>build-basex</id>
176-
<goals>
177-
<goal>build</goal>
178-
</goals>
179-
<configuration>
180-
<properties>
181-
<quarkus.profile>prod-basex</quarkus.profile>
182-
<quarkus.package.output-directory>basex-quarkus-app</quarkus.package.output-directory>
183-
<quarkus.docker.dockerfile-jvm-path>src/main/docker/Dockerfile-basex.jvm
184-
</quarkus.docker.dockerfile-jvm-path>
185-
<quarkus.docker.dockerfile-native-path>src/main/docker/Dockerfile-basex.native
186-
</quarkus.docker.dockerfile-native-path>
187-
<quarkus.container-image.tag>${project.version}-basex</quarkus.container-image.tag>
188-
<quarkus.container-image.additional-tags>latest-basex
189-
</quarkus.container-image.additional-tags>
190-
</properties>
191-
</configuration>
192-
</execution>
193170
<!-- Put this build execution as last, because we will use this image to do a basic native check (NativeHealthCheckIT).
194171
This information is written in "target\quarkus-artifact.properties" and used by the integration tests (failsafe).
195-
Sadly there is only 1 file create, so this build overwrites the one from basex.
196172
-->
197173
<execution>
198174
<id>build-postgresql</id>
@@ -285,23 +261,6 @@ SPDX-License-Identifier: Apache-2.0
285261
<artifactId>maven-failsafe-plugin</artifactId>
286262
<version>${surefire-plugin.version}</version>
287263
<executions>
288-
<execution>
289-
<id>integration-test-basex</id>
290-
<goals>
291-
<goal>integration-test</goal>
292-
<goal>verify</goal>
293-
</goals>
294-
<configuration>
295-
<systemPropertyVariables>
296-
<native.image.path>
297-
${project.build.directory}/basex-quarkus-app/${project.build.finalName}-runner
298-
</native.image.path>
299-
<java.util.logging.manager>org.jboss.logmanager.LogManager
300-
</java.util.logging.manager>
301-
<maven.home>${maven.home}</maven.home>
302-
</systemPropertyVariables>
303-
</configuration>
304-
</execution>
305264
</executions>
306265
</plugin>
307266
</plugins>

0 commit comments

Comments
 (0)