Skip to content

Commit 2986736

Browse files
Merge pull request #38 from pagopa/1.0.0-RC1
1.0.0-RC1
2 parents 79dfa84 + de3a49a commit 2986736

File tree

248 files changed

+31683
-0
lines changed

Some content is hidden

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

248 files changed

+31683
-0
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!--- Please always add a PR description as if nobody knows anything about the context these changes come from. -->
2+
<!--- Even if we are all from our internal team, we may not be on the same page. -->
3+
<!--- Write this PR as you were contributing to a public OSS project, where nobody knows you and you have to earn their trust. -->
4+
<!--- This will improve our projects in the long run! Thanks. -->
5+
6+
#### List of Changes
7+
8+
<!--- Describe your changes in detail -->
9+
10+
#### Motivation and Context
11+
12+
<!--- Why is this change required? What problem does it solve? -->
13+
14+
#### How Has This Been Tested?
15+
16+
<!--- Please describe in detail how you tested your changes. -->
17+
<!--- Include details of your testing environment, tests ran to see how -->
18+
<!--- your change affects other areas of the code, etc. -->
19+
20+
#### Screenshots (if appropriate):
21+
22+
#### Types of changes
23+
24+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
25+
26+
- [ ] Bug fix (non-breaking change which fixes an issue)
27+
- [ ] New feature (non-breaking change which adds functionality)
28+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as
29+
expected)
30+
31+
#### Checklist:
32+
33+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
34+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
35+
36+
- [ ] My change requires a change to the documentation.
37+
- [ ] I have updated the documentation accordingly.

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/pr_scan.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Check Build and Anchore on PR
2+
3+
on:
4+
pull_request:
5+
# Allows you to run this workflow manually from the Actions tab
6+
workflow_dispatch:
7+
8+
env:
9+
DOCKERFILE: Dockerfile.test-only
10+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11+
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
12+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
13+
PROJECT_KEY: 'pagopa_eng-lollipop-consumer-java-sdk'
14+
15+
jobs:
16+
pr_scan:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
22+
steps:
23+
- name: Checkout project sources
24+
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
25+
with:
26+
fetch-depth: 0
27+
- name: Setup Gradle
28+
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
29+
- name: Cache SonarCloud packages
30+
uses: actions/cache@v1
31+
with:
32+
path: ~/.sonar-project.properties/cache
33+
key: ${{ runner.os }}-sonar-project.properties
34+
restore-keys: ${{ runner.os }}-sonar-project.properties
35+
- name: Make gradlew executable
36+
run: chmod +x ./gradlew
37+
- name: Run build with Gradle Wrapper
38+
run: ./gradlew build testCodeCoverageReport
39+
- name: Add coverage to PR
40+
id: jacoco
41+
uses: madrapps/jacoco-report@7a334255fbce42f385d7567c25d986a9c62e2971
42+
with:
43+
paths: ${{ github.workspace }}/test-coverage/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
44+
token: ${{ secrets.GITHUB_TOKEN }}
45+
min-coverage-overall: 40
46+
min-coverage-changed-files: 60
47+
- name: Build the Docker image
48+
run: docker build . --file ${{ env.DOCKERFILE }} --tag localbuild/testimage:latest
49+
- name: Run the Anchore Grype scan action
50+
uses: anchore/scan-action@d5aa5b6cb9414b0c7771438046ff5bcfa2854ed7
51+
id: scan
52+
with:
53+
image: "localbuild/testimage:latest"
54+
fail-build: true
55+
severity-cutoff: "high"
56+
- name: Upload Anchore Scan Report
57+
uses: github/codeql-action/upload-sarif@9885f86fab4879632b7e44514f19148225dfbdcd
58+
if: always()
59+
with:
60+
sarif_file: ${{ steps.scan.outputs.sarif }}
61+
- name: Run Sonar Scanner on Pull Request
62+
if: ${{ github.event_name == 'pull_request' }}
63+
run: ./gradlew sonar --info
64+
-Dsonar.organization=pagopa
65+
-Dsonar.projectKey=${{ env.PROJECT_KEY }}
66+
-Dsonar.coverage.jacoco.xmlReportPaths=**/test-coverage/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
67+
-Dsonar.coverage.exclusions="**/config/*","**/*Mock*","**/model/**","**/entity/*","**/*Stub*","**/*Config*,**/*Exception*"
68+
-Dsonar.cpd.exclusions="**/model/**,**/entity/**,**/simple/internal/**"
69+
-Dsonar.host.url=https://sonarcloud.io
70+
-Dsonar.java.libraries="**/*.jar"
71+
-Dsonar.login=${{ env.SONAR_TOKEN }}
72+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
73+
-Dsonar.pullrequest.branch=${{ github.head_ref }}
74+
-Dsonar.pullrequest.base=${{ github.base_ref }}
75+
- name: Run Sonar Scanner
76+
if: ${{ github.event_name != 'pull_request' }}
77+
run: ./gradlew sonar --info
78+
-Dsonar.organization=pagopa
79+
-Dsonar.projectKey=${{ env.PROJECT_KEY }}
80+
-Dsonar.coverage.jacoco.xmlReportPaths=**/test-coverage/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml
81+
-Dsonar.coverage.exclusions="**/config/*","**/*Mock*","**/model/**","**/entity/*","**/*Stub*","**/*Config*,**/*Exception*"
82+
-Dsonar.cpd.exclusions="**/model/**,**/entity/**,**/simple/internal/**"
83+
-Dsonar.host.url=https://sonarcloud.io
84+
-Dsonar.java.libraries="**/*.jar"
85+
-Dsonar.login=${{ env.SONAR_TOKEN }}
86+
-Dsonar.branch.name=${{ github.head_ref }}
87+
- name: Publish to Maven Local
88+
run: ./gradlew publishToMavenLocal
89+
- name: Build Spring Sample
90+
working-directory: ./samples/spring
91+
run: chmod +x ./gradlew && ./gradlew bootJar
92+
- name: Run Docker compose with .env.dev
93+
run: docker compose --env-file e2e/.env.dev up -d --build --wait
94+
- name: Sleep for 30 seconds
95+
run: sleep 30s
96+
shell: bash
97+
- name: Install node modules and execute e2e tests
98+
working-directory: ./e2e
99+
run: npm install && npm run execute-test
100+
- name: Shutdown docker compose
101+
run: docker compose down

.github/workflows/release.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Publish package to GitHub Packages
2+
on:
3+
release:
4+
types: [created]
5+
env:
6+
DOCKERFILE: Dockerfile.test-only
7+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8+
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
9+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
20+
id: cache
21+
with:
22+
key: OpenJDK11U-jdk_x64_linux_hotspot_11.0.18_10.tar.gz
23+
path: |
24+
- ${{ runner.temp }}/jdkfile.tar.gz
25+
- ${{ runner.temp }}/jdkfile.sha256
26+
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3
27+
# jdkfile version hash was locally computed and checked against https://github.com/paketo-buildpacks/adoptium/releases
28+
- if: steps.cache.outputs.cache-hit != 'true'
29+
run: |
30+
echo "4a29efda1d702b8ff38e554cf932051f40ec70006caed5c4857a8cbc7a0b7db7 ${{ runner.temp }}/jdkfile.tar.gz" >> ${{ runner.temp }}/jdkfile.sha256
31+
echo {{ runner.temp }}/jdkfile.sha256
32+
curl -L "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.18%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.18_10.tar.gz" -o "${{ runner.temp }}/jdkfile.tar.gz"
33+
sha256sum --check --status "${{ runner.temp }}/jdkfile.sha256"
34+
- uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
35+
with:
36+
distribution: "jdkfile"
37+
jdkFile: "${{ runner.temp }}/jdkfile.tar.gz"
38+
java-version: "11"
39+
- name: Validate Gradle wrapper
40+
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
41+
- name: Make gradlew executable
42+
run: chmod +x ./gradlew
43+
- name: Publish package
44+
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
45+
with:
46+
arguments: publish
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
- name: Make spring sample gradlew executable
50+
run: chmod +x ./gradlew
51+
working-directory: ./samples/spring
52+
- name: Run build with Gradle Wrapper on Spring Sample
53+
run: ./gradlew bootJar
54+
working-directory: ./samples/spring
55+
- name: Log in to the Container registry
56+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
57+
with:
58+
registry: ${{ env.REGISTRY }}
59+
username: ${{ github.actor }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
- name: Extract metadata (tags, labels) for Docker
62+
id: meta
63+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
64+
with:
65+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
- name: Build and push Docker image
67+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
68+
with:
69+
context: .
70+
push: true
71+
tags: ${{ steps.meta.outputs.tags }}
72+
labels: ${{ steps.meta.outputs.labels }}
73+
secrets: |
74+
"GITHUB_ACTOR=${{ secrets.GITHUB_ACTOR }}"
75+
"GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}"

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore IntelliJ
5+
.idea
6+
7+
# Ignore Gradle build output directory
8+
build
9+
10+
# Ignore newman node modules and test reports
11+
e2e/newman
12+
e2e/node_modules

.pre-commit-config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# 1. `pip install pre-commit`
2+
# 2. `pre-commit install`
3+
repos:
4+
- repo: https://github.com/jguttman94/pre-commit-gradle
5+
rev: v0.2.1
6+
hooks:
7+
- id: gradle-task
8+
name: update-verification-metadata-sha256
9+
args: [ '-w', '--write-verification-metadata sha256 help']
10+
- id: gradle-spotless
11+
args: [ '-w']
12+
- id: gradle-check
13+
args: [ '-w' ]
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v3.2.0
16+
hooks:
17+
- id: trailing-whitespace
18+
- id: check-yaml
19+
- id: check-added-large-files
20+
- id: check-merge-conflict
21+
- repo: https://github.com/gitleaks/gitleaks
22+
rev: v8.16.1
23+
hooks:
24+
- id: gitleaks

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# see https://help.github.com/en/articles/about-code-owners#example-of-a-codeowners-file
2+
3+
* @pagopa/pagopa-tech

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM eclipse-temurin:11-jdk-alpine as build
2+
3+
WORKDIR /build
4+
COPY ./samples/spring .
5+
6+
FROM eclipse-temurin:11-jdk-alpine as runtime
7+
8+
WORKDIR /app
9+
COPY --from=build /build/build/libs/*.jar /app/app.jar
10+
COPY --from=build /build/build/resources/main/application.properties /app/application.properties
11+
12+
RUN apk --update --no-cache add curl
13+
14+
RUN addgroup -S appuser && adduser -S appuser -G appuser
15+
USER appuser
16+
17+
EXPOSE 8080
18+
ENTRYPOINT [ "java","-jar","/app/app.jar", "/app/application.properties" ]

Dockerfile.test-only

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM amazoncorretto:11
2+
3+
RUN yum update -y --security
4+
RUN mkdir /app
5+
6+
COPY core/build/libs/*.jar /app/
7+
COPY http-verifier/build/libs/*.jar /app/
8+
COPY redis-storage/build/libs/*.jar /app/
9+
COPY identity-service-rest-client-native/build/libs/*.jar /app/
10+
COPY assertion-rest-client-native/build/libs/*.jar /app/

0 commit comments

Comments
 (0)