-
Notifications
You must be signed in to change notification settings - Fork 5
90 lines (81 loc) · 2.16 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
name: paphos CI
on:
push:
branches: "*"
pull_request:
branches: "*"
jobs:
check-format:
strategy:
fail-fast: false
matrix:
crystal_version:
- 1.7.2
experimental:
- false
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@v2
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal_version }}
- name: Format
run: crystal tool format --check
specs:
strategy:
fail-fast: false
matrix:
crystal_version:
- 1.7.2
experimental:
- false
runs-on: ubuntu-latest
env:
LUCKY_ENV: test
DB_HOST: localhost
continue-on-error: ${{ matrix.experimental }}
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal_version }}
- name: Set up Crystal cache
uses: actions/cache@v2
id: crystal-cache
with:
path: |
~/.cache/crystal
lib
lucky_tasks
key: ${{ runner.os }}-crystal-${{ hashFiles('**/shard.lock') }}
restore-keys: |
${{ runner.os }}-crystal-
- name: Install shards
if: steps.crystal-cache.outputs.cache-hit != 'true'
run: shards check || shards install
- name: Build lucky_tasks
if: steps.crystal-cache.outputs.cache-hit != 'true'
run: crystal build tasks.cr -o ./lucky_tasks
- name: Prepare database
run: |
./lucky_tasks db.create
./lucky_tasks db.migrate
./lucky_tasks db.seed.required_data
- name: Run tests
run: crystal spec