-
Notifications
You must be signed in to change notification settings - Fork 16
185 lines (160 loc) · 5.48 KB
/
continuous-integration.yaml
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
180
181
182
183
184
185
# @author Ivan Senic
name: Continuous Integration
# runs on
# * pushes and pull requests on the "main" (pull request only for specific paths)
# * manual trigger
on:
push:
branches: [ "main"]
pull_request:
branches: [ "main", "feature/*" ]
workflow_dispatch:
# cancel same workflows in progress for pull request branches
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
# global env vars, available in all jobs and steps
env:
MAVEN_OPTS: '-Xmx4g'
DS_ARTIFACTORY_USERNAME: ${{ secrets.DS_ARTIFACTORY_USERNAME }}
DS_ARTIFACTORY_PASSWORD: ${{ secrets.DS_ARTIFACTORY_PASSWORD }}
# Jobs structure:
#
# 1. Runs unit tests
# 2. Then 2 jobs in parallel
# a) Integration tests with docker image
# b) Integration tests with native docker image
jobs:
# runs unit tests
build:
name: Unit tests
runs-on: ubuntu-latest
# max run time 12 minutes
timeout-minutes: 12
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: maven
- name: Setup Maven
run: |
mkdir -p ~/.m2
cat <<EOF > ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>stargate-central</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>stargate-snapshots</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>artifactory</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>artifactory-snapshots</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>artifactory-releases</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
</servers>
</settings>
EOF
# Adding -Poffline includes offline mode classes as well for test
- name: Build & Test
run: |
./mvnw -B -ntp clean test -Poffline
# runs int tests
int-tests:
name: Integration tests
needs: [ build ]
runs-on: ubuntu-latest
# max run time 40 minutes
timeout-minutes: 40
strategy:
# let all tests run, can find multiple failures in different setup
fail-fast: false
# matrix props:
matrix:
type: [ docker, native, dse-it ]
include:
- type: docker
profile: '-Poffline'
- type: dse-it
profile: '-Pdse-it,offline'
exclude:
- type: native
#profile: '-Pnative'
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: maven
- name: Setup Maven
run: |
mkdir -p ~/.m2
cat <<EOF > ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>stargate-central</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>stargate-snapshots</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>artifactory</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>artifactory-snapshots</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
<server>
<id>artifactory-releases</id>
<username>${DS_ARTIFACTORY_USERNAME}</username>
<password>${DS_ARTIFACTORY_PASSWORD}</password>
</server>
</servers>
</settings>
EOF
# login to ECR to we can pull coord image from there
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ECR_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.ECR_SECRET_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: 'true'
# run the int tests
- name: Integration Test
env:
COORD_IMAGE: ${{ secrets.ECR_REPOSITORY }}/stargateio/coordinator-dse-next
run: |
./mvnw -B -ntp clean verify -DskipUnitTests -Dquarkus.container-image.build=true -Dquarkus.container-image.tag=${{ github.sha }} -Dstargate.int-test.coordinator.image=$COORD_IMAGE -Drun-create-index-parallel=true ${{ matrix.profile }}