-
Notifications
You must be signed in to change notification settings - Fork 55
176 lines (153 loc) · 4.42 KB
/
ci.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
name: CI
on:
pull_request:
branches: "*"
push:
branches: master
schedule:
- cron: "0 7 * * 1"
jobs:
lint:
strategy:
matrix:
include:
- DB: mysql
- DB: postgres
runs-on: ubuntu-22.04
env:
DB: ${{ matrix.DB }}
steps:
- name: Install Crystal
uses: oprypin/install-crystal@v1
with:
crystal: 1.8.2
- name: Donwload sources
uses: actions/checkout@v2
- name: Check formatting
if: ${{ matrix.linter }}
run: make format
- name: Install dependencies
run: shards install
- name: Run linter
if: ${{ matrix.linter }}
run: make lint
test:
needs: lint
strategy:
fail-fast: false
matrix:
include:
- crystal_version: 1.0.0
DB: mysql
os: ubuntu-20.04
- crystal_version: 1.0.0
DB: postgres
os: ubuntu-20.04
- crystal_version: 1.1.0
DB: mysql
os: ubuntu-20.04
- crystal_version: 1.1.0
DB: postgres
os: ubuntu-20.04
- crystal_version: 1.2.2
DB: mysql
- crystal_version: 1.2.2
DB: postgres
- crystal_version: 1.3.2
DB: mysql
- crystal_version: 1.3.2
DB: postgres
- crystal_version: 1.4.1
DB: mysql
- crystal_version: 1.4.1
DB: postgres
- crystal_version: 1.5.1
DB: mysql
- crystal_version: 1.5.1
DB: postgres
- crystal_version: 1.6.2
DB: mysql
- crystal_version: 1.6.2
DB: postgres
- crystal_version: 1.7.3
DB: mysql
- crystal_version: 1.7.3
DB: postgres
- crystal_version: 1.8.2
DB: mysql
- crystal_version: 1.8.2
DB: postgres
- crystal_version: 1.9.2
DB: mysql
- crystal_version: 1.9.2
DB: postgres
- crystal_version: 1.10.1
DB: mysql
- crystal_version: 1.10.1
DB: postgres
- crystal_version: 1.11.1
DB: mysql
integration: true
linter: true
- crystal_version: 1.11.1
DB: postgres
integration: true
linter: true
- crystal_version: 1.11.1
DB: postgres
other: MT=1
- crystal_version: 1.11.1
DB: postgres
pair: true
other: PAIR_DB_USER=root PAIR_DB_PASSWORD=
- crystal_version: 1.11.1
DB: mysql
pair: true
other: PAIR_DB_USER=dbuser PAIR_DB_PASSWORD=dbpassword
runs-on: ${{ matrix.os || 'ubuntu-22.04' }}
env:
DB: ${{ matrix.DB }}
PAIR: ${{ matrix.pair }}
DB_USER: root
DB_PASSWORD: ${{ matrix.DB != 'mysql' && 'dbpassword' || null }}
steps:
- name: Export rest variables
run: export ${{ matrix.other }}
- name: Install Crystal
uses: oprypin/install-crystal@v1
with:
crystal: ${{matrix.crystal_version}}
- name: Donwload sources
uses: actions/checkout@v2
- name: Install dependencies
run: |
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
if [ $(version '${{ matrix.crystal_version }}') -lt $(version '1.8.2') ]; then
cp .github/shard_1_3_2.yml shard.yml
fi
shards install
- name: 'Install MySQL'
if: ${{ matrix.DB == 'mysql' || matrix.pair }}
run: bash .github/setup_mysql.sh
- name: Install PostgreSQL
if: ${{ matrix.DB == 'postgres' || matrix.pair }}
uses: Daniel-Marynicz/postgresql-action@master
with:
postgres_image_tag: '12'
postgres_user: ${{ env.DB_USER }}
postgres_password: ${{ env.DB_PASSWORD }}
- name: Create configuration file
run: bash ./scripts/setup.sh .github/database.yml
- name: Run migrations
run: make sam db:setup
- name: Run specs
run: |
if [ $MT == '1' ]
then
crystal spec -Dpreview_mt
else
crystal spec --error-trace
fi
- name: Run integration specs
if: ${{ matrix.integration }}
run: bash .github/run_integration_tests.sh