Skip to content

Commit

Permalink
test pipeline code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Krusty93 committed Jan 22, 2024
1 parent e6cf5de commit e33cbc5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 31 deletions.
51 changes: 20 additions & 31 deletions .github/workflows/code_review_ms.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,35 @@
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/templates/call_code_review.yml'

# TODO: remove, just for testing
push:
branches:
- EC-95-pipeline-code-review-con-reusable-workflows

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/templates/call_code_review.yml
name: Microservice Code Review
secrets: inherit
with:
pr_number: ${{ github.event.pull_request.number }}
source_branch: ${{ github.head_ref }}
target_branch: ${{ github.base_ref }}
41 changes: 41 additions & 0 deletions .github/workflows/templates/call_code_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
workflow_call:
inputs:
pr_number:
type: string
required: true
source_branch:
type: string
required: true
target_branch:
type: string
required: true

jobs:
code_review:
name: 'Code Review'
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=pagopa_selfcare-onboarding
-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 }}

0 comments on commit e33cbc5

Please sign in to comment.