This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EC-150] Add PR GitHub pipeline (#395)
- Loading branch information
Showing
6 changed files
with
246 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
**/.dockerignore | ||
**/.git | ||
**/bin | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md | ||
|
||
**/.idea | ||
.idea | ||
**/.mvn | ||
.mvn | ||
|
||
**/target | ||
|
||
# Created by .ignore support plugin (hsz.mobi) | ||
### Maven template | ||
target/ | ||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
.mvn/wrapper/maven-wrapper.jar | ||
### Java template | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
### JetBrains template | ||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | ||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
|
||
# User-specific stuff | ||
.idea/**/workspace.xml | ||
.idea/**/tasks.xml | ||
.idea/**/usage.statistics.xml | ||
.idea/**/dictionaries | ||
.idea/**/shelf | ||
|
||
# Sensitive or high-churn files | ||
.idea/**/dataSources/ | ||
.idea/**/dataSources.ids | ||
.idea/**/dataSources.local.xml | ||
.idea/**/sqlDataSources.xml | ||
.idea/**/dynamic.xml | ||
.idea/**/uiDesigner.xml | ||
.idea/**/dbnavigator.xml | ||
|
||
# Gradle | ||
.idea/**/gradle.xml | ||
.idea/**/libraries | ||
|
||
# Gradle and Maven with auto-import | ||
# When using Gradle or Maven with auto-import, you should exclude module files, | ||
# since they will be recreated, and may cause churn. Uncomment if using | ||
# auto-import. | ||
# .idea/modules.xml | ||
# .idea/*.iml | ||
# .idea/modules | ||
|
||
# CMake | ||
cmake-build-*/ | ||
|
||
# Mongo Explorer plugin | ||
.idea/**/mongoSettings.xml | ||
|
||
# File-based project format | ||
*.iws | ||
|
||
# IntelliJ | ||
out/ | ||
|
||
# mpeltonen/sbt-idea plugin | ||
.idea_modules/ | ||
|
||
# JIRA plugin | ||
atlassian-ide-plugin.xml | ||
|
||
# Cursive Clojure plugin | ||
.idea/replstate.xml | ||
|
||
# Crashlytics plugin (for Android Studio and IntelliJ) | ||
com_crashlytics_export_strings.xml | ||
crashlytics.properties | ||
crashlytics-build.properties | ||
fabric.properties | ||
|
||
# Editor-based Rest Client | ||
.idea/httpRequests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
on: | ||
workflow_call: | ||
inputs: | ||
pr_number: | ||
type: string | ||
required: true | ||
module: | ||
type: string | ||
required: true | ||
source_branch: | ||
type: string | ||
required: true | ||
target_branch: | ||
type: string | ||
required: true | ||
sonar_key: | ||
type: string | ||
required: true | ||
|
||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
jobs: | ||
code_review: | ||
name: 'Build & Analysis' | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
packages: read | ||
|
||
steps: | ||
|
||
- name: Setup Maven Action | ||
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 | ||
with: | ||
checkout-fetch-depth: 0 | ||
java-version: 17 | ||
java-distribution: 'temurin' | ||
maven-version: '3.9.5' | ||
cache-enabled: true | ||
|
||
- name: Build | ||
run: | | ||
mvn -f ./pom.xml \ | ||
-B \ | ||
clean org.jacoco:jacoco-maven-plugin:prepare-agent \ | ||
verify org.jacoco:jacoco-maven-plugin:report org.jacoco:jacoco-maven-plugin:report-aggregate | ||
- name: Analyze | ||
run: | | ||
xmlReportPaths=$(find "$(pwd)" -path '*jacoco.xml' | sed 's/.*/&/' | tr '\n' ','); | ||
mvn -f pom.xml -B verify sonar:sonar \ | ||
-Dsonar.coverage.jacoco.xmlReportPaths=$xmlReportPaths \ | ||
-Dsonar.organization=pagopa \ | ||
-Dsonar.projectKey=${{ inputs.sonar_key }} \ | ||
-Dsonar.token=${{ secrets.SONAR_TOKEN }} \ | ||
-Dsonar.pullrequest.key=${{ inputs.pr_number }} \ | ||
-Dsonar.pullrequest.branch=${{ inputs.source_branch }} \ | ||
-Dsonar.pullrequest.base=refs/remotes/origin/${{ inputs.target_branch }} \ | ||
-Dsonar.exclusions='**/enums/**, **/model/**, **/constant/**, **/*Constant*, **/*Config.java, **/*Scheduler.java, **/*Application.java, **/src/test/**, **/Dummy*.java' | ||
env: | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
FROM maven@sha256:dcfe7934d3780beda6e1f0f641bc7db3fa9b8818899981f6eddae052c78394c7 | ||
FROM maven:3-eclipse-temurin-17 AS builder | ||
|
||
COPY . . | ||
|
||
RUN mvn clean package -DskipTests=true | ||
|
||
FROM openjdk:17-jdk AS runtime | ||
|
||
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder ./target/*.jar ./app.jar | ||
|
||
ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.1.1/applicationinsights-agent-3.1.1.jar /applicationinsights-agent.jar | ||
VOLUME /tmp | ||
COPY target/*.jar app.jar | ||
ENTRYPOINT ["java","-jar","app.jar"] | ||
|
||
EXPOSE 8080 | ||
USER 1001 | ||
|
||
ENTRYPOINT ["java", "-jar", "app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM maven@sha256:dcfe7934d3780beda6e1f0f641bc7db3fa9b8818899981f6eddae052c78394c7 | ||
ADD https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.1.1/applicationinsights-agent-3.1.1.jar /applicationinsights-agent.jar | ||
VOLUME /tmp | ||
COPY target/*.jar app.jar | ||
ENTRYPOINT ["java","-jar","app.jar"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters