Skip to content

Commit 2612283

Browse files
committed
Add initial CI
1 parent 2c6e3df commit 2612283

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Crystal Specs with PostgreSQL
2+
3+
on:
4+
push: {}
5+
pull_request:
6+
branches: [ main, master ]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
crystal:
15+
- 1.13.3
16+
- 1.14.1
17+
- latest
18+
- nightly
19+
postgres:
20+
- "14"
21+
- "15"
22+
- "16"
23+
- "17"
24+
25+
# Service containers to run with the job
26+
services:
27+
# PostgreSQL service
28+
postgres:
29+
image: postgres:${{ matrix.postgres }}
30+
env:
31+
POSTGRES_USER: postgres
32+
POSTGRES_PASSWORD: postgres
33+
POSTGRES_DB: crystal_test
34+
ports:
35+
# Map port 5432 on service container to the host
36+
- 5432:5432
37+
# Set health checks to wait until postgres has started
38+
options: >-
39+
--health-cmd pg_isready
40+
--health-interval 10s
41+
--health-timeout 5s
42+
--health-retries 5
43+
44+
steps:
45+
# Check out repository code
46+
- name: Checkout code
47+
uses: actions/checkout@v3
48+
49+
# Install Crystal
50+
- name: Setup Crystal
51+
uses: crystal-lang/install-crystal@v1
52+
with:
53+
crystal: ${{ matrix.crystal }}
54+
55+
56+
# Install Crystal dependencies
57+
- name: Install dependencies
58+
run: shards install
59+
60+
# Run Crystal specs
61+
- name: Run tests
62+
run: crystal spec
63+
env:
64+
# Environment variables to connect to PostgreSQL
65+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/crystal_test

0 commit comments

Comments
 (0)