Skip to content

Commit

Permalink
Merge pull request #351 from com-pas/develop
Browse files Browse the repository at this point in the history
Merge `develop` into `main`
  • Loading branch information
juancho0202 authored Oct 4, 2023
2 parents 4e462f8 + 6cc1f66 commit 964e308
Show file tree
Hide file tree
Showing 80 changed files with 397 additions and 301 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
java-version: '17'
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v1
uses: fsfe/reuse-action@v2
166 changes: 95 additions & 71 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,82 +4,106 @@

name: SonarCloud Analysis

on:
push:
branches:
- '**'
pull_request:
branches:
- 'main'
- 'develop'
pull_request_target:
branches:
- 'main'
- 'develop'
on:
workflow_run:
workflows: [SonarCloud Build]
types: [completed]

jobs:
sonar-check:
name: Sonar Check
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
timeout-minutes: 15

if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: echo event
run: cat $GITHUB_EVENT_PATH
- name: Download PR number artifact
if: github.event.workflow_run.event == 'pull_request'
uses: dawidd6/action-download-artifact@v2
with:
workflow: SonarCloud Build
run_id: ${{ github.event.workflow_run.id }}
name: PR_NUMBER
- name: Read PR_NUMBER.txt
if: github.event.workflow_run.event == 'pull_request'
id: pr_number
uses: juliangruber/read-file-action@v1
with:
path: ./PR_NUMBER.txt
- name: Request GitHub API for PR data
if: github.event.workflow_run.event == 'pull_request'
uses: octokit/[email protected]
id: get_pr_data
with:
route: GET /repos/{full_name}/pulls/{number}
number: ${{ steps.pr_number.outputs.content }}
full_name: ${{ github.event.repository.full_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
ref: ${{ github.event.workflow_run.head_branch }}
fetch-depth: 0
- name: Checkout base branch
if: github.event.workflow_run.event == 'pull_request'
run: |
git remote add upstream ${{ github.event.repository.clone_url }}
git fetch upstream
git checkout -B ${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} upstream/${{ fromJson(steps.get_pr_data.outputs.data).base.ref }}
git checkout ${{ github.event.workflow_run.head_branch }}
git clean -ffdx && git reset --hard HEAD
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Set Common Sonar Variables
id: sonar_env
run: |
echo "##[set-output name=sonar_opts;]$(echo -Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectKey=com-pas_compas-scl-data-service \
-Dsonar.organization=com-pas )"
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v21
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Build and analyze (Pull Request)
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./mvnw -B -s custom_maven_settings.xml -Psonar \
${{ steps.sonar_env.outputs.sonar_opts }} \
-Dsonar.pullrequest.branch=${{ github.ref_name }} \
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} \
-Dsonar.pullrequest.base=${{ github.base_ref }} \
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} \
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
- name: Build and analyze (Push)
if: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./mvnw -B -s custom_maven_settings.xml -Psonar \
${{ steps.sonar_env.outputs.sonar_opts }} \
-Dsonar.branch.name=${{ github.ref_name }} \
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
- name: Set Common Sonar Variables
id: sonar_env
run: |
echo "##[set-output name=sonar_opts;]$(echo -Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectKey=com-pas_compas-scl-data-service \
-Dsonar.organization=com-pas )"
- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v21
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Build and analyze (Pull Request)
if: ${{ github.event.workflow_run.event == 'pull_request' || (github.event.workflow_run.actor == 'dependabot[bot]' && github.event.workflow_run.event == 'pull_request_target') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./mvnw -B -s custom_maven_settings.xml -Psonar \
${{ steps.sonar_env.outputs.sonar_opts }} \
-Dsonar.pullrequest.branch=${{ fromJson(steps.get_pr_data.outputs.data).head.ref }} \
-Dsonar.pullrequest.key=${{ fromJson(steps.get_pr_data.outputs.data).number }} \
-Dsonar.pullrequest.base=${{ fromJson(steps.get_pr_data.outputs.data).base.ref }} \
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} \
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
- name: Build and analyze (Push)
if: ${{ github.event.workflow_run.event == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
./mvnw -B -s custom_maven_settings.xml -Psonar \
${{ steps.sonar_env.outputs.sonar_opts }} \
-Dsonar.scm.revision=${{ github.event.workflow_run.head_sha }} \
-Dsonar.branch.name=${{ github.event.workflow_run.head_branch }} \
clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
77 changes: 77 additions & 0 deletions .github/workflows/sonarcloud-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# SPDX-FileCopyrightText: 2022 Alliander N.V.
#
# SPDX-License-Identifier: Apache-2.0

name: SonarCloud Build

on:
push:
branches:
- '**'
pull_request:
branches:
- 'main'
- 'develop'
pull_request_target:
branches:
- 'main'
- 'develop'

jobs:
precheck-build:
name: Pre Check Build
runs-on: ubuntu-latest
timeout-minutes: 30

if: ${{ (github.event_name != 'pull_request_target' && github.actor != 'dependabot[bot]') || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Create custom Maven Settings.xml
uses: whelk-io/maven-settings-xml-action@v21
with:
output_file: custom_maven_settings.xml
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
- name: Build and analyze (Pull Request)
if: ${{ github.event_name == 'pull_request' || (github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./mvnw -B -s custom_maven_settings.xml clean verify
- name: Build and analyze (Push)
if: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./mvnw -B -s custom_maven_settings.xml clean verify
- name: Save PR number to file
if: github.event_name == 'pull_request'
run: echo ${{ github.event.number }} > PR_NUMBER.txt
- name: Archive PR number
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: PR_NUMBER
path: PR_NUMBER.txt
2 changes: 1 addition & 1 deletion app/src/main/docker/Dockerfile-basex.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-1107
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8-860

ARG JAVA_PACKAGE=java-17-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/docker/Dockerfile-basex.native
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# docker run -i --rm -p 8080:8080 quarkus/app
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-1107
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8-860
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/docker/Dockerfile-postgresql.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/app-jvm
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-1107
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8-860

ARG JAVA_PACKAGE=java-17-openjdk-headless
ARG RUN_JAVA_VERSION=1.3.8
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/docker/Dockerfile-postgresql.native
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# docker run -i --rm -p 8080:8080 quarkus/app
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-1107
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.8-860
WORKDIR /work/
RUN chown 1001 /work \
&& chmod "g+rwX" /work \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.lfenergy.compas.core.commons.ElementConverter;
import org.lfenergy.compas.scl.data.util.SclDataModelMarshaller;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;

/**
* Create Beans from other dependencies that are used in the application.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import org.lfenergy.compas.core.commons.model.ErrorResponse;
import org.lfenergy.compas.scl.data.exception.CompasNoDataFoundException;

import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.ext.ExceptionMapper;
import jakarta.ws.rs.ext.Provider;

@Provider
public class CompasNoDataFoundExceptionHandler implements ExceptionMapper<CompasNoDataFoundException> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Liveness;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@Liveness
@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.Readiness;

import javax.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.ApplicationScoped;

@Readiness
@ApplicationScoped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import org.lfenergy.compas.scl.data.rest.v1.model.UserInfoResponse;
import org.lfenergy.compas.scl.extensions.model.SclFileType;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import java.util.Arrays;
import java.util.Comparator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import org.lfenergy.compas.scl.data.service.CompasSclDataService;
import org.lfenergy.compas.scl.extensions.model.SclFileType;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.validation.Valid;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.validation.Valid;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import java.util.UUID;

import static org.lfenergy.compas.scl.data.rest.Constants.*;
Expand Down
Loading

0 comments on commit 964e308

Please sign in to comment.