Skip to content

Commit

Permalink
ops: using cache and 3.9.5 version about maven on workflow (#52)
Browse files Browse the repository at this point in the history
* added mock upload contract

* remove sparse checkout from code review

* fetch-depth to 0

* test

* add Run tests step

* fix run tests

* test

* setup-maven-action

* fix version

* fix version

* fix test value

* cache-enabled tru

* cache-enabled: true

* test

* enable cache

* fix checkout ref

* fix code review functions

* use pin-github-action
  • Loading branch information
manuraf authored Nov 28, 2023
1 parent d22c8f2 commit 66ca8ca
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 43 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
name: Add label to PR based on the paths of files being changed
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # pin@v4

check_pr_size:
name: Check PR size doesn't break set limit
runs-on: ubuntu-latest
steps:
# checkout your code with your git history
- uses: actions/checkout@v3
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3
with:
fetch-depth: 0

Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/code_review_functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ jobs:
packages: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
apps/onboarding-functions
libs/
test-coverage/
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # [email protected]
with:
checkout-fetch-depth: 0
java-version: 17
distribution: 'temurin'
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

- name: Build and analyze on Pull Requests
shell: bash
Expand All @@ -43,7 +39,7 @@ jobs:
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
-Dsonar.pullrequest.base=refs/remotes/origin/${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
13 changes: 7 additions & 6 deletions .github/workflows/code_review_libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ jobs:
packages: read
id-token: write
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # [email protected]
with:
checkout-fetch-depth: 0
java-version: 17
distribution: 'temurin'
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

- name: Build and analyze on Pull Requests
shell: bash
Expand All @@ -38,7 +39,7 @@ jobs:
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
-Dsonar.pullrequest.base=refs/remotes/origin/${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
21 changes: 9 additions & 12 deletions .github/workflows/code_review_ms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ on:
- reopened
paths:
- 'apps/onboarding-ms/**'

workflow_dispatch:


jobs:

code-review:
Expand All @@ -23,18 +24,14 @@ jobs:
packages: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
apps/onboarding-ms
libs/
test-coverage/
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # [email protected]
with:
checkout-fetch-depth: 0
java-version: 17
distribution: 'temurin'
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

- name: Build and analyze on Pull Requests
shell: bash
Expand All @@ -44,7 +41,7 @@ jobs:
-Dsonar.token=${{ secrets.SONAR_TOKEN }}
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
-Dsonar.pullrequest.base=refs/remotes/origin/${{ github.base_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17 changes: 8 additions & 9 deletions .github/workflows/deploy_onboarding_functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,23 @@ jobs:
build:
name: Build Onboarding Functions
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == 'true') }}
if: ${{ (github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true) }}
environment: "${{ inputs.environment != null && inputs.environment || (github.base_ref == 'main' && 'prod' || (github.base_ref == 'develop' && 'uat' || 'dev')) }}-cd"
permissions:
packages: write
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
name: Checkout
with:
ref: ${{ github.ref_name }}

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Setup Maven Action
uses: s4u/setup-maven-action@fa2c7e4517ed008b1f73e7e0195a9eecf5582cd4 # [email protected]
with:
checkout-fetch-depth: 0
checkout-ref: ${{ github.ref_name }}
java-version: 17
distribution: 'temurin'
java-distribution: 'temurin'
maven-version: '3.9.5'
cache-enabled: true

- name: "Build Functions and dependencies"
shell: bash
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release_onboarding_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ name: Release onboarding sdk
on:
workflow_dispatch:


jobs:
setup:
name: Release
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # pin@v3
with:
ref: ${{ github.ref_name }}

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # pin@v3
with:
distribution: 'temurin'
java-version: '17'
cache: maven

- uses: s4u/[email protected]
- uses: s4u/maven-settings-action@60912582505985be4cc55d2b890eb32767f8de5f # pin@v2.8.0
with:
servers: '[{"id": "selfcare-github", "username": "${{ github.actor }}", "password": "${{ secrets.GITHUB_TOKEN }}"}]'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.quarkus.test.vertx.RunOnVertxContext;
import io.quarkus.test.vertx.UniAsserter;
import io.smallrye.mutiny.Uni;
import it.pagopa.selfcare.azurestorage.AzureBlobClient;
import it.pagopa.selfcare.onboarding.common.InstitutionType;
import it.pagopa.selfcare.onboarding.common.PartyRole;
import it.pagopa.selfcare.onboarding.controller.request.*;
Expand Down Expand Up @@ -60,6 +61,9 @@ public class OnboardingServiceDefaultTest {
@InjectMock
ProductService productService;

@InjectMock
AzureBlobClient azureBlobClient;

@InjectMock
SignatureService signatureService;

Expand Down Expand Up @@ -599,6 +603,8 @@ void complete(UniAsserter asserter) {
mockSimpleProductValidAssert(onboarding.getProductId(), false, asserter);
mockVerifyOnboardingNotFound(asserter);

when(azureBlobClient.uploadFile(any(),any(),any())).thenReturn("upload-file");

asserter.assertThat(() -> onboardingService.complete(onboarding.getId().toHexString(), testFile),
Assertions::assertNotNull);
}
Expand Down

0 comments on commit 66ca8ca

Please sign in to comment.