Update README.md #122
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: ReleaseProcess2-0 | |
on: | |
push: | |
branches: [ master ] | |
release: | |
branches: [ master ] | |
env: | |
PACT_BROKER_URL: ${{ secrets.PACT_BROKER_URL }} | |
PACT_BROKER_HOST: ${{ secrets.PACT_BROKER_HOST }} | |
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }} | |
PACT_BROKER_PUBLISH_VERIFICATION_RESULTS: true | |
GIT_COMMIT: ${{ github.SHA }} | |
jobs: | |
quality-metrics: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Maven clean install | |
run: mvn clean install | |
- name: Mutation tests for shop module | |
run: mvn -f shop/ pitest:mutationCoverage | |
- name: Mutation tests for inventory module | |
run: mvn -f inventory/ pitest:mutationCoverage | |
- name: Mutation tests for shipment module | |
run: mvn -f shipment/ pitest:mutationCoverage | |
- name: Archive code coverage - Inventory | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeCoverage-inventory | |
path: inventory/target/site/jacoco | |
- name: Archive mutation coverage - Inventory | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mutationCoverage-inventory | |
path: inventory/target/pit-reports | |
- name: Archive code coverage - Shop | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeCoverage-shop | |
path: shop/target/site/jacoco | |
- name: Archive mutation coverage - Shop | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mutationCoverage-shop | |
path: shop/target/pit-reports | |
- name: Archive code coverage - Shipment | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeCoverage-shipment | |
path: shipment/target/site/jacoco | |
- name: Archive mutation coverage - Shipment | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mutationCoverage-shipment | |
path: shipment/target/pit-reports | |
sonarCloud: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Build and analyze | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar | |
docker-build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Maven clean install | |
run: mvn clean install | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build docker image - inventory | |
run: mvn -f inventory/ spring-boot:build-image -Dspring-boot.build-image.imageName=ecommerceapp/inventory | |
- name: Tag Docker Image - inventory | |
run: docker image tag ecommerceapp/inventory teixeirafernando/ecommerceapp-inventory:latest | |
- name: Push Docker Image - inventory | |
run: docker image push teixeirafernando/ecommerceapp-inventory:latest | |
- name: Build docker image - shop | |
run: mvn -f shop/ spring-boot:build-image -Dspring-boot.build-image.imageName=ecommerceapp/shop | |
- name: Tag Docker Image - shop | |
run: docker image tag ecommerceapp/shop teixeirafernando/ecommerceapp-shop:latest | |
- name: Push Docker Image - shop | |
run: docker image push teixeirafernando/ecommerceapp-shop:latest | |
- name: Build docker image - shipment | |
run: mvn -f shipment/ spring-boot:build-image -Dspring-boot.build-image.imageName=ecommerceapp/shipment | |
- name: Tag Docker Image - shipment | |
run: docker image tag ecommerceapp/shipment teixeirafernando/ecommerceapp-shipment:latest | |
- name: Push Docker Image - shipment | |
run: docker image push teixeirafernando/ecommerceapp-shipment:latest | |
pact-record-deployment: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download repository | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'adopt' | |
- name: Cache | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Generate test jars for dependencies | |
run: mvn clean install | |
- name: Run Pact Consumer Tests | |
run: make run-pact-consumer-tests | |
- name: Publish Pacts to PactFlow | |
run: GIT_BRANCH=master make publish-pacts | |
- name: Inventory Provider Tests | |
run: GIT_BRANCH=master make run-pact-provider-tests | |
- name: Run pact record-deployment | |
run: | | |
GIT_BRANCH=master PACTICIPANT=ShipmentModule make record_deployment | |
GIT_BRANCH=master PACTICIPANT=ShopModule make record_deployment | |
GIT_BRANCH=master PACTICIPANT=InventoryModule make record_deployment |