-
Notifications
You must be signed in to change notification settings - Fork 275
166 lines (139 loc) · 5.73 KB
/
github-actions.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
# Starter workflow to use github-actions ci. This checks out repository, builds and runs unit tests.
# Reference: https://docs.github.com/en/actions/guides/building-and-testing-java-with-gradle
name: Github Actions CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Ambry
uses: actions/checkout@v2
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Set up MySQL
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE AmbryRepairRequests;' -uroot -proot
mysql -e 'USE AmbryRepairRequests; SOURCE ./ambry-mysql/src/main/resources/AmbryRepairRequests.ddl;' -uroot -proot
- name: Add custom MySQL user
# Temporary settings to use same username and password as travis ci
run: |
mysql -e 'CREATE USER 'travis'@'localhost';' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot -proot
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot
- uses: burrunan/gradle-cache-action@v1
name: Run unit tests excluding ambry-store
with:
job-id: jdk11
arguments: --scan -x :ambry-store:test build codeCoverageReport
gradle-version: wrapper
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
store-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Ambry
uses: actions/checkout@v2
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: burrunan/gradle-cache-action@v1
name: Run unit tests for ambry-store
with:
job-id: jdk11
arguments: --scan :ambry-store:test codeCoverageReport
gradle-version: wrapper
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
int-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Ambry
uses: actions/checkout@v2
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Set up MySQL
run: |
sudo systemctl start mysql.service
mysql -e 'CREATE DATABASE AccountMetadata;' -uroot -proot
mysql -e 'USE AccountMetadata; SOURCE ./ambry-account/src/main/resources/AccountSchema.ddl;' -uroot -proot
mysql -e 'CREATE DATABASE ambry_container_storage_stats;' -uroot -proot
mysql -e 'USE ambry_container_storage_stats; SOURCE ./ambry-mysql/src/main/resources/AmbryContainerStorageStats.ddl;' -uroot -proot
mysql -e 'CREATE DATABASE AmbryNamedBlobs;' -uroot -proot
mysql -e 'USE AmbryNamedBlobs; SOURCE ./ambry-named-mysql/src/main/resources/NamedBlobsSchema.ddl;' -uroot -proot
mysql -e 'CREATE DATABASE AmbryRepairRequests;' -uroot -proot
mysql -e 'USE AmbryRepairRequests; SOURCE ./ambry-mysql/src/main/resources/AmbryRepairRequests.ddl;' -uroot -proot
- name: Add custom MySQL user
# Temporary settings to use same username and password as travis ci
run: |
mysql -e 'CREATE USER 'travis'@'localhost';' -uroot -proot
mysql -e 'GRANT ALL PRIVILEGES ON * . * TO 'travis'@'localhost';' -uroot -proot
mysql -e 'FLUSH PRIVILEGES;' -uroot -proot
- uses: burrunan/gradle-cache-action@v1
name: Run integration tests
with:
job-id: jdk11
arguments: --scan intTest codeCoverageReport
gradle-version: wrapper
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
publish:
runs-on: ubuntu-latest
needs: [ unit-test, store-test, int-test ]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
steps:
- name: Checkout Ambry
uses: actions/checkout@v2
# Full fetch depth is used to fetch all existing tags in the repo to assign a version for this build
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- uses: burrunan/gradle-cache-action@v1
name: Build artifacts and create pom files
with:
job-id: jdk11
arguments: --scan assemble publishToMavenLocal
gradle-version: wrapper
- uses: burrunan/gradle-cache-action@v1
name: Test publication by uploading in dry run mode
with:
job-id: jdk11
arguments: -i --scan artifactoryPublishAll -Partifactory.dryRun
gradle-version: wrapper
- uses: burrunan/gradle-cache-action@v1
name: Tag and upload to JFrog Artifactory
with:
job-id: jdk11
arguments: -i --scan ciPerformRelease
gradle-version: wrapper