Skip to content

Commit 3482597

Browse files
breaking: P4ADEV-1930 update github actions (#13)
* updated release and snapshot action * updated codereview * Minor fix * Minor fix * Minor fix * typo fix * try sonar cloud action * try sonar cloud action * try sonar cloud action * pre-commit fixs
1 parent 62bac3a commit 3482597

File tree

7 files changed

+222
-85
lines changed

7 files changed

+222
-85
lines changed

.github/workflows/codereview.yml

Lines changed: 79 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,90 @@ name: TEMPLATE-PAYMENTS - Code Review
22

33
on:
44
push:
5-
branches:
6-
- main
7-
- uat
8-
- develop
5+
branches: [ main, uat, develop ]
96
pull_request:
10-
types:
11-
- opened
12-
- edited
13-
- synchronize
7+
types: [ opened, edited, synchronize ]
8+
branches: [ main, uat, develop ]
9+
10+
env:
11+
JAVA_VERSION: '21'
12+
JAVA_DISTRIBUTION: 'corretto'
13+
1414
jobs:
15-
build:
15+
code-review:
16+
name: Code Review & Quality Analysis
1617
runs-on: ubuntu-latest
18+
timeout-minutes: 30
19+
1720
steps:
18-
- name: Checkout sources
19-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #v4.1.7
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
2023
with:
2124
fetch-depth: 0
2225

2326
- name: Setup Java
24-
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1
25-
with:
26-
distribution: 'corretto'
27-
java-version: 21
28-
29-
- name: Grant execute permission for gradlew
30-
run: chmod +x ./gradlew
31-
32-
- name: Build with Gradle
33-
working-directory: ./
34-
run: ./gradlew clean build jacocoTestReport
35-
36-
- name: Sonar Scan
37-
working-directory: ./
38-
run: >
39-
./gradlew sonar
40-
-Dorg.gradle.jvmargs=-Xmx4096M
41-
-Dsonar.host.url=https://sonarcloud.io
42-
-Dsonar.organization=${{ vars.SONARCLOUD_ORG }}
43-
-Dsonar.projectKey=${{ vars.SONARCLOUD_PROJECT_KEY }}
44-
-Dsonar.projectName="${{ vars.SONARCLOUD_PROJECT_NAME }}"
45-
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
46-
-Dsonar.sources=src/main
47-
-Dsonar.tests=src/test
48-
-Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
49-
-Dsonar.exclusions='**/enums/**, **/model/**, **/dto/**, **/*Constant*, **/*Config.java, **/*Scheduler.java, **/*Application.java, **/src/test/**, **/Dummy*.java'
27+
uses: actions/setup-java@v4
28+
with:
29+
distribution: ${{ env.JAVA_DISTRIBUTION }}
30+
java-version: ${{ env.JAVA_VERSION }}
31+
cache: 'gradle'
32+
33+
- name: Cache Gradle packages
34+
uses: actions/cache@v3
35+
with:
36+
path: |
37+
~/.gradle/caches
38+
~/.gradle/wrapper
39+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
40+
restore-keys: |
41+
${{ runner.os }}-gradle-
42+
43+
- name: Run Tests & Coverage
44+
id: tests
45+
run: ./gradlew clean build jacocoTestReport --info
46+
47+
- name: SonarCloud Scan
48+
uses: SonarSource/sonarqube-scan-action@master
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
52+
with:
53+
args: >
54+
-Dsonar.organization=${{ vars.SONARCLOUD_ORG }}
55+
-Dsonar.projectKey=${{ vars.SONARCLOUD_PROJECT_KEY }}
56+
-Dsonar.sources=src/main
57+
-Dsonar.tests=src/test
58+
-Dsonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
59+
-Dsonar.exclusions='**/enums/**, **/model/**, **/dto/**, **/*Constant*, **/*Config.java, **/*Scheduler.java, **/*Application.java, **/src/test/**, **/Dummy*.java'
60+
-Dsonar.qualitygate.wait=true
61+
62+
- name: SonarQube Quality Gate check
63+
uses: sonarsource/sonarqube-quality-gate-action@master
64+
env:
65+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
66+
with:
67+
scanMetadataReportFile: .scannerwork/report-task.txt
68+
69+
- name: Save Test Results
70+
if: always()
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: test-reports-${{ github.run_id }}
74+
path: build/reports/tests/
75+
retention-days: 7
76+
77+
- name: Save Coverage Results
78+
if: always()
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: coverage-reports-${{ github.run_id }}
82+
path: build/reports/jacoco/
83+
retention-days: 7
84+
85+
- name: Merge Reports
86+
if: always()
87+
uses: actions/upload-artifact/merge@v4
88+
with:
89+
name: all-reports-${{ github.run_id }}
90+
pattern: '*-reports-${{ github.run_id }}'
91+
retention-days: 7

.github/workflows/flow-release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 🚀 Flow Release
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- uat
8+
- main
9+
paths-ignore:
10+
- 'CODEOWNERS'
11+
- '**.md'
12+
- '.**'
13+
workflow_dispatch:
14+
15+
jobs:
16+
17+
checkout:
18+
name: 🔖 Checkout Repository
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
23+
with:
24+
ref: ${{ github.ref_name }}
25+
26+
payments-flow-release:
27+
name: 🚀 Release
28+
runs-on: ubuntu-22.04
29+
needs: checkout
30+
steps:
31+
- name: 🚀 release + docker
32+
# https://github.com/pagopa/github-actions-template/releases/tag/v2.0.0
33+
uses: pagopa/github-actions-template/payments-flow-release@b825ee193430395706a4a7e580b8435bdded0227
34+
with:
35+
current_branch: ${{ github.ref_name }}
36+
37+
azure-devops-trigger:
38+
name: 🅰️ Azure DevOps Pipeline Trigger
39+
needs: payments-flow-release
40+
runs-on: ubuntu-22.04
41+
steps:
42+
- name: Trigger Azure DevOps Pipeline
43+
# https://github.com/pagopa/github-actions-template/releases/tag/v2.1.0
44+
uses: pagopa/github-actions-template/azure-devops-trigger-pipeline@cad30356d9046af6e7b0cee43db4cf919cc408f9
45+
with:
46+
enable_azure_devops_step: 'true'
47+
azure_devops_project_url: 'https://dev.azure.com/pagopaspa/p4pa-projects'
48+
azure_devops_pipeline_name: 'p4pa-payhub-deploy-aks.deploy'
49+
azure_devops_pat: ${{ secrets.AZURE_DEVOPS_TOKEN }}
50+
azure_template_parameters: |
51+
{
52+
"APPS_TOP": "[p4pa-auth]",
53+
"POSTMAN_BRANCH": "${{ github.ref_name }}",
54+
"TRIGGER_MESSAGE": "p4pa-auth"
55+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: 📦 Flow Snapshot Docker
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'develop'
7+
- 'uat'
8+
- 'main'
9+
paths-ignore:
10+
- 'CODEOWNERS'
11+
- '**.md'
12+
- '.**'
13+
workflow_dispatch:
14+
inputs:
15+
docker_build_enabled:
16+
description: 'Enable Docker build'
17+
required: false
18+
default: 'true'
19+
azdo_trigger_enabled:
20+
description: 'Enable Azure DevOps trigger'
21+
required: false
22+
default: 'true'
23+
argocd_target_branch:
24+
description: 'argocd target branch name'
25+
required: false
26+
default: 'main'
27+
postman_branch:
28+
description: postman branch name'
29+
required: false
30+
default: 'develop'
31+
32+
env:
33+
# branch choosed by workflow_dispatch or by push event
34+
CURRENT_BRANCH: ${{ github.event.inputs.branch || github.ref_name }}
35+
36+
jobs:
37+
checkout:
38+
name: 🔖 Checkout Repository
39+
runs-on: ubuntu-22.04
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
43+
with:
44+
ref: ${{ env.CURRENT_BRANCH }}
45+
46+
docker-build:
47+
name: 📦 Docker Build and Push
48+
needs: checkout
49+
runs-on: ubuntu-22.04
50+
if: ${{ github.event_name == 'push' || github.event.inputs.docker_build_enabled == 'true' }}
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
54+
with:
55+
ref: ${{ env.CURRENT_BRANCH }}
56+
57+
- name: Run Snapshot Docker Build/Push
58+
# https://github.com/pagopa/github-actions-template/releases/tag/v2.0.0
59+
uses: pagopa/github-actions-template/payments-flow-docker-snapshot@b825ee193430395706a4a7e580b8435bdded0227
60+
with:
61+
current_branch: ${{ github.ref_name }}
62+
63+
azure-devops-trigger:
64+
name: 🅰️ Azure DevOps Pipeline Trigger
65+
needs: docker-build
66+
runs-on: ubuntu-22.04
67+
if: |
68+
always() &&
69+
needs.docker-build.result != 'failure' &&
70+
github.event.inputs.azdo_trigger_enabled == 'true'
71+
steps:
72+
- name: Trigger Azure DevOps Pipeline
73+
# https://github.com/pagopa/github-actions-template/releases/tag/v2.1.0
74+
uses: pagopa/github-actions-template/azure-devops-trigger-pipeline@cad30356d9046af6e7b0cee43db4cf919cc408f9
75+
with:
76+
enable_azure_devops_step: 'true'
77+
azure_devops_project_url: 'https://dev.azure.com/pagopaspa/p4pa-projects'
78+
azure_devops_pipeline_name: 'p4pa-payhub-deploy-aks.deploy'
79+
azure_devops_pat: ${{ secrets.AZURE_DEVOPS_TOKEN }}
80+
azure_template_parameters: |
81+
{
82+
"APPS_TOP": "[one-color]",
83+
"ARGOCD_TARGET_BRANCH": "${{ github.event.inputs.argocd_target_branch }}",
84+
"POSTMAN_BRANCH": "${{ github.event.inputs.postman_branch }}",
85+
"TRIGGER_MESSAGE": "p4pa-auth"
86+
}

.github/workflows/release.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/snapshot-docker.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

force-release

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1623

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
server:
2-
http: "\${SERVER_PORT:8080}"
2+
http: "${SERVER_PORT:8080}"
33

44
spring:
55
application:

0 commit comments

Comments
 (0)