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

[EC-95] Reusable workflows for code review pipelines #97

Merged
merged 8 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
44 changes: 44 additions & 0 deletions .github/workflows/call_code_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on:
workflow_call:
inputs:
pr_number:
type: string
required: true
source_branch:
type: string
required: true
target_branch:
type: string
required: true
sonar_key:
type: string
required: true

jobs:
code_review:
name: 'Build & Analysis'
runs-on: ubuntu-20.04

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 and Analyze
shell: bash
run: mvn --projects :test-coverage --also-make verify -Ponboarding-ms,report,coverage
-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 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
45 changes: 16 additions & 29 deletions .github/workflows/code_review_functions.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
name: Code Review onboarding-functions

on:
workflow_dispatch:

pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
- reopened
- ready_for_review
paths:
- 'apps/onboarding-functions/**'

workflow_dispatch:
- 'apps/onboarding-ms/pom.xml'
- '.github/workflows/code_review_functions.yml'
- '.github/workflows/call_code_review.yml'

jobs:

code-review:
runs-on: ubuntu-latest
permissions:
packages: read
id-token: write
steps:
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # [email protected]
with:
checkout-fetch-depth: 0
java-version: 17
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

- name: Build and analyze on Pull Requests
shell: bash
run: mvn --projects :test-coverage --also-make verify -Ponboarding-functions,report,coverage
-Dsonar.organization=pagopa
-Dsonar.projectKey=pagopa_selfcare-onboarding
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=refs/remotes/origin/${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
code_review:
uses: ./.github/workflows/call_code_review.yml
name: OnBoarding function Code Review
secrets: inherit
with:
pr_number: ${{ github.event.pull_request.number }}
source_branch: ${{ github.head_ref }}
target_branch: ${{ github.base_ref }}
sonar_key: 'pagopa_selfcare-onboarding'
44 changes: 15 additions & 29 deletions .github/workflows/code_review_libs.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,30 @@
name: Code Review Libs

on:
workflow_dispatch:

pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
- reopened
- ready_for_review
paths:
- 'libs/**'

workflow_dispatch:
- '.github/workflows/code_review_libs.yml'
- '.github/workflows/call_code_review.yml'

jobs:

code-review:
runs-on: ubuntu-latest
permissions:
packages: read
id-token: write
steps:
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # [email protected]
with:
checkout-fetch-depth: 0
java-version: 17
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

- name: Build and analyze on Pull Requests
shell: bash
run: mvn --projects :test-coverage --also-make verify -Ponboarding-sdk,report,coverage
-Dsonar.organization=pagopa
-Dsonar.projectKey=pagopa_selfcare-onboarding
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=refs/remotes/origin/${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
code_review:
uses: ./.github/workflows/call_code_review.yml
name: Libs Code Review
secrets: inherit
with:
pr_number: ${{ github.event.pull_request.number }}
source_branch: ${{ github.head_ref }}
target_branch: ${{ github.base_ref }}
sonar_key: 'pagopa_selfcare-onboarding'
47 changes: 16 additions & 31 deletions .github/workflows/code_review_ms.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,31 @@
name: Code Review onboarding-ms

# Controls when the workflow will run
on:
workflow_dispatch:

pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
- reopened
- ready_for_review
paths:
- 'apps/onboarding-ms/**'

workflow_dispatch:

- 'apps/onboarding-ms/pom.xml'
- '.github/workflows/code_review_ms.yml'
- '.github/workflows/call_code_review.yml'

jobs:

code-review:
runs-on: ubuntu-latest
permissions:
packages: read
id-token: write
steps:
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # [email protected]
with:
checkout-fetch-depth: 0
java-version: 17
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

- name: Build and analyze on Pull Requests
shell: bash
run: mvn --projects :test-coverage --also-make verify -Ponboarding-ms,report,coverage
-Dsonar.organization=pagopa
-Dsonar.projectKey=pagopa_selfcare-onboarding
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=refs/remotes/origin/${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
code_review:
uses: ./.github/workflows/call_code_review.yml
name: OnBoarding ms Code Review
secrets: inherit
with:
pr_number: ${{ github.event.pull_request.number }}
source_branch: ${{ github.head_ref }}
target_branch: ${{ github.base_ref }}
sonar_key: 'pagopa_selfcare-onboarding'