-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (96 loc) · 3.1 KB
/
build.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
name: Build branch
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
services:
postgres:
image: postgres:11.1
env:
POSTGRES_DB: postgres-test
POSTGRES_USER: postgres-user
POSTGRES_PASSWORD: postgres-password
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready"
--health-interval 10s
--health-timeout 5s
--health-retries 10
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
env:
ACCEPT_EULA: Y
MSSQL_PID: Express
SA_PASSWORD: A_Str0ng_Required_Password
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "A_Str0ng_Required_Password" -Q 'SELECT 1' || exit 1"
--health-interval 10s
--health-timeout 5s
--health-retries 10
mysql:
image: mysql:8.0.21
env:
MYSQL_ROOT_PASSWORD: mysql-password
MYSQL_DATABASE: mysql-text
MYSQL_USER: mysql-user
MYSQL_PASSWORD: mysql-password
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h localhost -u mysql-user --password=mysql-password"
--health-interval 10s
--health-timeout 5s
--health-retries 10
mongodb:
image: mongo:3.1.5
ports:
- 27017:27017
options: >-
--health-cmd "echo 'db.runCommand({ ping: 1 })' | mongo localhost:27017/test --quiet"
--health-interval 10s
--health-timeout 5s
--health-retries 10
cassandra:
image: cassandra
ports:
- 9042:9042
env:
CASSANDRA_DC: local
CASSANDRA_ENDPOINT_SNITCH: GossipingPropertyFileSnitch
options:
--health-cmd "cqlsh localhost 9042 -u cassandra -p cassandra -e 'describe cluster'"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v3
- name: Init database data for PostgreSQL
run: PGPASSWORD=postgres-password psql -h localhost -p 5432 -U postgres-user -f docker/postgresql/setup.sql postgres-test
- name: Init database data for MySQL
run: |
mysql --host 127.0.0.1 --port 3306 -u root --password=mysql-password --database=mysql-text < docker/mysql/setup.sql
- name: Init database data for MSSQL
run: sqlcmd -S localhost -U sa -P A_Str0ng_Required_Password -d master -i docker/mssql/setup.sql
- name: Init database data for Cassandra
run: |
docker cp docker/cassandra/setup.cql ${{ job.services.cassandra.id }}:/setup.cql
docker exec ${{ job.services.cassandra.id }} cqlsh localhost 9042 -f setup.cql
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 11
cache: "gradle"
- name: Build
run: ./gradlew build