forked from adorsys/xs2a-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (120 loc) · 4.14 KB
/
develop.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
name: Develop CI
on:
push:
branches:
- develop
env:
XS2A_ADAPTER_IMAGE_NAME: xs2a-adapter
XS2A_ADAPTER_IMAGE_TAG: develop
OPENSHIFT_REGISTRY: openshift-registry.adorsys.de
OPENSHIFT_NAMESPACE_DEV: xs2a-adapter-dev
OPENSHIFT_NAMESPACE_INTEG: xs2a-adapter-integ
SONAR_HOST: https://sonarcloud.io
SONAR_ORG: adorsys
SONAR_PRJ_KEY: adorsys_xs2a-adapter
jobs:
build:
name: Build project & docker file
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: 8
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build project
run: mvn clean verify -B
- name: Build docker image
env:
LOCAL_IMAGE_NAME: ${{ env.XS2A_ADAPTER_IMAGE_NAME }}:test
run: docker build -t ${LOCAL_IMAGE_NAME} .
deploy:
name: Deploy docker image to the registry
needs: build
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: 8
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Publish packages
run: mvn -B deploy -Dmaven.test.skip=true -Dbuild.number=${GITHUB_SHA::7}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
env:
LOCAL_IMAGE_NAME: ${{ env.XS2A_ADAPTER_IMAGE_NAME }}:${{ env.XS2A_ADAPTER_IMAGE_TAG }}
run: docker build -t ${LOCAL_IMAGE_NAME} .
- name: DEV. Docker login
uses: azure/docker-login@v1
with:
login-server: ${{ env.OPENSHIFT_REGISTRY }}
username: image-pusher
password: ${{ secrets.OPENSHIFT_TOKEN }}
- name: DEV. Deploy docker image
env:
LOCAL_IMAGE_NAME: ${{ env.XS2A_ADAPTER_IMAGE_NAME }}:${{ env.XS2A_ADAPTER_IMAGE_TAG }}
OPENSHIFT_IMAGE_NAME: ${{ env.OPENSHIFT_REGISTRY }}/${{ env.OPENSHIFT_NAMESPACE_DEV }}/${{ env.XS2A_ADAPTER_IMAGE_NAME }}:${{ env.XS2A_ADAPTER_IMAGE_TAG }}
run: |
docker tag ${LOCAL_IMAGE_NAME} ${OPENSHIFT_IMAGE_NAME}
docker push ${OPENSHIFT_IMAGE_NAME}
- name: INTEG. Docker login
uses: azure/docker-login@v1
with:
login-server: ${{ env.OPENSHIFT_REGISTRY }}
username: image-pusher
password: ${{ secrets.OPENSHIFT_TOKEN_INTEG }}
- name: INTEG. Deploy docker image
env:
LOCAL_IMAGE_NAME: ${{ env.XS2A_ADAPTER_IMAGE_NAME }}:${{ env.XS2A_ADAPTER_IMAGE_TAG }}
OPENSHIFT_IMAGE_NAME: ${{ env.OPENSHIFT_REGISTRY }}/${{ env.OPENSHIFT_NAMESPACE_INTEG }}/${{ env.XS2A_ADAPTER_IMAGE_NAME }}:${{ env.XS2A_ADAPTER_IMAGE_TAG }}
run: |
docker tag ${LOCAL_IMAGE_NAME} ${OPENSHIFT_IMAGE_NAME}
docker push ${OPENSHIFT_IMAGE_NAME}
sonar:
name: Publish code coverage to Sonar Cloud
needs: build
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: 11
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Collect code coverage data
run: >
mvn
clean
org.jacoco:jacoco-maven-plugin:prepare-agent
install
sonar:sonar
-B
-Pcoverage
-Dsonar.host.url=${{ env.SONAR_HOST }}
-Dsonar.projectKey=${{ env.SONAR_PRJ_KEY }}
-Dsonar.organization=${{ env.SONAR_ORG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}