Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PPANTT-206] feat: Switch to SpringBoot #10

Merged
merged 27 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e501c3a
[PPANTT-206] feat: Init switch to SpringBoot
svariant Nov 25, 2024
5bc396c
[PPANTT-206] fix: PDV tokenizer injection
svariant Nov 25, 2024
d5e22ac
[PPANTT-206] feat: Improved topics nomenclature
svariant Nov 25, 2024
43154ac
[PPANTT-206] chore: Clean code
svariant Nov 25, 2024
61b44d7
[PPANTT-206] chore: Update env example
svariant Nov 25, 2024
0f8bd80
[PPANTT-206] chore: Unit test
svariant Nov 26, 2024
af9967c
[PPANTT-206] chore: Fix PR comments
svariant Nov 26, 2024
9a54c54
[PPANTT-206] chore: Change back Retry pdv tokenizer
svariant Nov 26, 2024
6dbf156
[PPANTT-206] fix: PDV tokenizer bean config
svariant Nov 26, 2024
749d61e
[PPANTT-206] chore: Delete openapi generation
svariant Nov 26, 2024
bbf06cb
[PPANTT-206] feat: Remove utils classes & junit dependency
svariant Nov 26, 2024
b91fe19
[PPANTT-206] chore: Clean code
svariant Nov 26, 2024
245fddc
[PPANTT-206] fix: Object mapper configuration
svariant Nov 26, 2024
0c5cd9e
[PPANTT-206] chore: Clean code & change pdv client env config
svariant Nov 26, 2024
3304951
[PPANTT-206] fix: jackson properties
svariant Nov 26, 2024
6f20c3f
[PPANTT-206] fix env
gioelemella Nov 26, 2024
62da318
Merge branch 'PPANTT-206-switch-to-springboot' of https://github.com/…
gioelemella Nov 26, 2024
063e3ae
[PPANTT-206] chore: Update coverage exclusion
svariant Nov 26, 2024
d055842
[PPANTT-206] fix tests
gioelemella Nov 26, 2024
e73b3d5
Merge branch 'PPANTT-206-switch-to-springboot' of https://github.com/…
gioelemella Nov 26, 2024
b882db9
Update src/main/java/it/gov/pagopa/gpd/ingestion/manager/Application.…
svariant Nov 26, 2024
1e7fceb
[PPANTT-206] chore: Update pre-commit
svariant Nov 26, 2024
5c84cda
Merge remote-tracking branch 'origin/PPANTT-206-switch-to-springboot'…
svariant Nov 26, 2024
b9ed973
[PPANTT-206] chore: Commented check format
svariant Nov 26, 2024
fea4ca8
[PPANTT-206] chore: Excluded ApplicationTest.java from coverage
svariant Nov 26, 2024
7d4868f
[PPANTT-206] chore: Excluded ApplicationTest.java from coverage
svariant Nov 26, 2024
45e5a8c
[PPANTT-206] chore: Improve unit test
svariant Nov 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 0 additions & 101 deletions .github/maven_code_review/action.yml

This file was deleted.

177 changes: 78 additions & 99 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,51 +63,32 @@ jobs:
body: 'This pull request does not contain a valid label. Please add one of the following labels: `[patch, minor, major, skip]`'
})
core.setFailed('Missing required labels')


check_format:
name: Check Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3

- name: Formatting
id: format
continue-on-error: true
uses: axel-op/googlejavaformat-action@v3
with:
args: "--set-exit-if-changed"

- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
if: steps.format.outcome != 'success'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log(context);
var comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
for (const comment of comments.data) {
console.log(comment);
if (comment.body.includes('Comment this PR with')){
github.rest.issues.deleteComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id
})
}
}
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Comment this PR with *update_code* to update `openapi.json` and format the code. Consider to use pre-commit to format the code.'
})
core.setFailed('Format your code.')
# Commented because of false positives
# formatter:
# name: Formatter
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
# - uses: actions/setup-java@v4
# with:
# distribution: 'temurin' # See 'Supported distributions' for available options
# java-version: '21'
# - name: Find incorrectly formatted file
# uses: axel-op/googlejavaformat-action@v3
# with:
# args: "--replace"
# skip-commit: true
# - name: Print diffs
# run: git --no-pager diff
# - name: suggester / google-java-format
# uses: reviewdog/action-suggester@v1
# with:
# tool_name: google-java-format
# - name: Check Format
# uses: axel-op/googlejavaformat-action@v3
# with:
# args: "--set-exit-if-changed"

check_size:
runs-on: ubuntu-latest
Expand All @@ -120,7 +101,8 @@ jobs:
- name: Check Size
uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
env:
IGNORED_FILES: openapi.json, openapi-node.json
IGNORED_FILES: openapi.json
BRANCH_NAME: ${{ github.head_ref}}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
Expand All @@ -129,44 +111,36 @@ jobs:
var changes = additions + deletions
console.log('additions: '+additions+' + deletions: '+deletions+ ' = total changes: ' + changes);

const { IGNORED_FILES } = process.env
const { IGNORED_FILES, BRANCH_NAME } = process.env
const ignored_files = IGNORED_FILES.trim().split(',').filter(word => word.length > 0);
if (ignored_files.length > 0){
var ignored = 0
const execSync = require('child_process').execSync;
for (const file of IGNORED_FILES.trim().split(',')) {
const ignored_additions_str = execSync('git --no-pager diff --numstat origin/main..origin/${{ github.head_ref}} | grep ' + file + ' | cut -f 1', { encoding: 'utf-8' })
const ignored_deletions_str = execSync('git --no-pager diff --numstat origin/main..origin/${{ github.head_ref}} | grep ' + file + ' | cut -f 2', { encoding: 'utf-8' })

const ignored_additions_str = execSync('git --no-pager diff --numstat origin/main..origin/'+BRANCH_NAME+' | grep ' + file + ' | cut -f 1', { encoding: 'utf-8' })
const ignored_deletions_str = execSync('git --no-pager diff --numstat origin/main..origin/'+BRANCH_NAME+' | grep ' + file + ' | cut -f 2', { encoding: 'utf-8' })

const ignored_additions = ignored_additions_str.split('\n').map(elem=> parseInt(elem || 0)).reduce(
(accumulator, currentValue) => accumulator + currentValue,
0);
const ignored_deletions = ignored_deletions_str.split('\n').map(elem=> parseInt(elem || 0)).reduce(
(accumulator, currentValue) => accumulator + currentValue,
0);

ignored += ignored_additions + ignored_deletions;
}
changes -= ignored
console.log('ignored lines: ' + ignored + ' , consider changes: ' + changes);
}

if (changes < 200){
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['size/small']
})


var labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});

var labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});

if (changes <= 400){
if (labels.data.find(label => label.name == 'size/large')){
github.rest.issues.removeLabel({
issue_number: context.issue.number,
Expand All @@ -177,50 +151,55 @@ jobs:
}
}

if (changes > 400){
if (changes >= 200){
if (labels.data.find(label => label.name == 'size/small')){
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'size/small'
})
}
}

var comments = await github.rest.issues.listComments({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
for (const comment of comments.data) {
if (comment.body.includes('This PR exceeds the recommended size')){
github.rest.issues.deleteComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id
})
}
}

if (changes < 200){
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['size/large']
labels: ['size/small']
})

var comments = await github.rest.issues.listComments({
}

if (changes > 400){
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});
for (const comment of comments.data) {
if (comment.body.includes('This PR exceeds the recommended size')){
github.rest.issues.deleteComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id
})
}
}
repo: context.repo.repo,
labels: ['size/large']
})

github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'This PR exceeds the recommended size of 400 lines. Please make sure you are NOT addressing multiple issues with one PR. _Note this PR might be rejected due to its size._'
})

var labels = await github.rest.issues.listLabelsOnIssue({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo
});

if (labels.data.find(label => label.name == 'size/small')){
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: 'size/small'
})
}

}
}
10 changes: 4 additions & 6 deletions .github/workflows/code_review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Code Review
uses: ./.github/maven_code_review
uses: pagopa/github-actions-template/maven-code-review@186af0dfc5ee51e6150046051d4e0b6444e15aed # v1.10.6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
sonar_token: ${{ secrets.SONAR_TOKEN }}
project_key: ${{env.PROJECT_KEY}}
jdk_version: 17
maven_version: 3.9.3
coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/**,**/producer/**,**/enumeration/**,**/exception/**"
cpd_exclusions: "**/model/**,**/entity/*"
coverage_exclusions: "**/config/*,**/*Mock*,**/model/**,**/entity/**,**/producer/**,**/consumer/**,**/enumeration/**,**/exception/**,**/controller/**,**/Application.java"
cpd_exclusions: "**/models/**,**/entity/*"
java_version: 17
Loading
Loading