-
Notifications
You must be signed in to change notification settings - Fork 8
130 lines (130 loc) · 4.12 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
name: Test
on:
push:
paths:
- '**.cr'
- '.github/workflows/test.yml'
pull_request:
branches: [master]
paths:
- '**.cr'
- '.github/workflows/test.yml'
schedule:
- cron: '0 6 * * 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@v4
- 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@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Cache shards
uses: actions/cache@v4
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: Run tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/shield_spec
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings
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: ${{ matrix.experimental }}
steps:
- name: Download source
uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal }}
- name: Cache shards
uses: actions/cache@v4
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: Run tests
env:
DATABASE_URL: postgres://root@localhost:26257/shield_spec?sslmode=disable
SKIP_LOAD_ENV: "true"
run: crystal spec --error-on-warnings