-
Notifications
You must be signed in to change notification settings - Fork 55
201 lines (178 loc) · 5.2 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
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.2
DB: mysql
- crystal_version: 1.11.2
DB: postgres
- crystal_version: 1.12.2
DB: mysql
- crystal_version: 1.12.2
DB: postgres
- crystal_version: 1.13.1
DB: mysql
os: ubuntu-24.04
integration: true
linter: true
- crystal_version: 1.13.1
DB: postgres
pg_version: '16'
os: ubuntu-24.04
integration: true
linter: true
- crystal_version: 1.13.1
DB: postgres
pg_version: '16'
os: ubuntu-24.04
other: MT=1
- crystal_version: 1.13.1
DB: postgres
pg_version: '16'
os: ubuntu-24.04
pair: true
other: PAIR_DB_USER=root PAIR_DB_PASSWORD=
- crystal_version: 1.13.1
DB: mysql
pg_version: '16'
os: ubuntu-24.04
pair: true
other: PAIR_DB_USER=dbuser PAIR_DB_PASSWORD=dbpassword
- crystal_version: nightly
DB: mysql
os: ubuntu-24.04
- crystal_version: nightly
DB: postgres
pg_version: '16'
os: ubuntu-24.04
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: crystal-lang/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_simple.yml shard.yml
cp .github/shard.override.yml shard.override.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: ${{ matrix.pg_version || '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