-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (150 loc) · 4.98 KB
/
test.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
name: Test
on:
push:
paths:
- '**.cr'
- '.github/workflows/test.yml'
pull_request:
branches: [master]
paths:
- '**.cr'
- '.github/workflows/test.yml'
schedule:
- cron: '0 7 * * 6'
jobs:
checks:
strategy:
fail-fast: false
matrix:
crystal: ['1.6.0']
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Install shards
run: shards install
- name: Lint code
run: ./bin/ameba
specs__postgresql:
strategy:
fail-fast: false
matrix:
crystal: ['1.6.0', latest]
experimental: [false]
shard_file: [shard.yml]
include:
- crystal: '1.10.0'
experimental: false
shard_file: shard.latest.yml
- crystal: latest
experimental: false
shard_file: shard.latest.yml
- crystal: nightly
experimental: true
shard_file: shard.edge.yml
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Cache shards
uses: actions/cache@v3
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-
- name: Install shards
run: shards update --skip-postinstall --skip-executables
env:
SHARDS_OVERRIDE: ${{ matrix.shard_file }}
- name: Install Postgresql
run: sudo apt -y install postgresql
- name: Start Postgresql
run: sudo systemctl start postgresql
- name: Set Postgres password
run: >-
sudo -u postgres psql -c
"ALTER USER postgres WITH PASSWORD 'password';"
- name: Install Redis
run: sudo apt -y install redis
- name: Start Redis
run: sudo systemctl start redis
- name: Run client tests
env:
CLIENT_CACHE_REDIS_URL: redis://localhost:6379/0
CLIENT_DATABASE_URL: postgres://postgres:password@localhost:5432/samba_client_spec
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings spec/client
- name: Run server tests
env:
SERVER_DATABASE_URL: postgres://postgres:password@localhost:5432/samba_server_spec
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings spec/server
specs__cockroachdb:
strategy:
fail-fast: false
matrix:
cockroachdb: ['v22.2.0', latest]
crystal: ['1.10.0']
experimental: [false]
shard_file: [shard.yml, shard.latest.yml]
include:
- cockroachdb: latest
crystal: latest
experimental: true
shard_file: shard.edge.yml
runs-on: ubuntu-latest
continue-on-error: false
steps:
- name: Download source
uses: actions/checkout@v3
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Cache shards
uses: actions/cache@v3
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-
- name: Install shards
run: shards update --skip-postinstall --skip-executables
env:
SHARDS_OVERRIDE: ${{ matrix.shard_file }}
- name: Install CockroachDB
run: |
sudo apt -y install tar wget
sudo mkdir -p /usr/local/lib/cockroach
wget -O cockroachdb.tgz https://binaries.cockroachdb.com/cockroach-${{ matrix.cockroachdb }}.linux-amd64.tgz
tar -xzf cockroachdb.tgz
sudo cp -f cockroach-*/cockroach /usr/local/bin/
sudo chmod +x /usr/local/bin/cockroach
sudo cp -rf cockroach-*/lib/* /usr/local/lib/cockroach/
working-directory: /tmp
- name: Start CockroachDB
run: cockroach start-single-node --insecure --listen-addr=localhost:36257 --sql-addr=localhost:26257 --background
- name: Install Redis
run: sudo apt -y install redis
- name: Start Redis
run: sudo systemctl start redis
- name: Run client tests
env:
CLIENT_CACHE_REDIS_URL: redis://localhost:6379/0
CLIENT_DATABASE_URL: postgres://root@localhost:26257/samba_client_spec?sslmode=disable
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings spec/client
- name: Run server tests
env:
SERVER_DATABASE_URL: postgres://root@localhost:26257/samba_server_spec?sslmode=disable
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings spec/server