-
Notifications
You must be signed in to change notification settings - Fork 5
179 lines (166 loc) · 6.28 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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@v3
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@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
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@v3
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