Fix/obj store rollback (#194) #612
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build everytime push or merge | |
on: | |
push: | |
branches: | |
- '**' # matches every branch | |
defaults: | |
run: | |
shell: bash | |
permissions: write-all | |
jobs: | |
build: | |
strategy: | |
matrix: | |
environment: [dev] | |
name: "build" | |
runs-on: ubuntu-latest | |
environment: ${{ matrix.environment }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@67fbcbb121271f7775d2e7715933280b06314838 | |
with: | |
role-to-assume: ${{ secrets.IAM_ROLE }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2 | |
- name: Build docker image | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
REPOSITORY: ${{ vars.DOCKER_IMAGE_NAME}} | |
DOCKER_IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker build -f src/main/java/it/gov/pagopa/atmlayer/service/model/docker/Dockerfile.native -t $REGISTRY/$REPOSITORY:$DOCKER_IMAGE_TAG . \ | |
--build-arg QUARKUS_PROFILE=prod \ | |
--build-arg APP_NAME=atm-layer-model | |
test-and-coverage: | |
strategy: | |
matrix: | |
environment: [dev] | |
name: "coverage" | |
runs-on: ubuntu-latest | |
environment: ${{ matrix.environment }} | |
steps: | |
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Setup JDK | |
uses: graalvm/setup-graalvm@2911b2304bee2c2f59b9a67bf45f025a6b6de4b1 # v1 | |
with: | |
java-version: '21' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test and Integration tests | |
run: | | |
mvn test -Dquarkus.package.type=native -Dquarkus.application.name=atm-layer-model -Dquarkus.profile=prod | |
- name: Create Status check based on postman results | |
id: process-postman | |
uses: im-open/process-postman-test-results@4cc90df9ffdd1554366e19e759a15d008bdf3c39 # v2.1.5 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
results-file: src/test/resources/integration-test/output/result.json | |
report-name: 'Postman build: ${{ github.run_number }}' | |
create-status-check: true | |
create-pr-comment: true | |
update-comment-if-one-exists: true | |
ignore-test-failures: true | |
timezone: 'europe/rome' | |
- name: Fail if there were errors in the postman tests | |
if: steps.process-postman.outputs.test-outcome == 'Failed' | |
run: | | |
echo "There were postman failures." | |
exit 1 | |
- name: Upload result.html | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
with: | |
name: html-report | |
path: src/test/resources/integration-test/output/result.html | |
- name: JaCoCo Code Coverage Report | |
id: jacoco_reporter | |
uses: PavanMudigonda/jacoco-reporter@76044ebc031589dcbce0bb1048ffee1072a43f97 # v4.9 | |
with: | |
coverage_results_path: target/jacoco-report/jacoco.xml | |
coverage_report_name: 'Coverage build ${{ github.run_number }}' | |
coverage_report_title: JaCoCo | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
skip_check_run: false | |
minimum_coverage: 90 | |
fail_below_threshold: false | |
publish_only_summary: false | |
- name: Fail Build if overall coverage is less than 90% | |
if: steps.jacoco_reporter.outputs.coverage_percentage < 90.0 | |
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6 | |
with: | |
script: | | |
core.setFailed('Overall coverage is less than 90%!') | |
- name: Code Review | |
run: | | |
mvn sonar:sonar -Dsonar.token=${{ secrets.SONAR_TOKEN }} -Dsonar.projectKey=pagopa_atm-layer-model \ | |
-Dsonar.organization=pagopa -Dsonar.java.binaries=src/main \ | |
-Dsonar.coverage.jacoco.xmlReportPaths=../atm-layer-model/target/jacoco-report/jacoco.xml -Pcoverage \ | |
-Dsonar.exclusions=src/main/java/it/gov/pagopa/atmlayer/service/model/docker/Dockerfile.native |