Skip to content

Commit 67f7d7c

Browse files
authored
Merge pull request #1 from crystal-cache/github-workflow
setup github workflow
2 parents 9aadac2 + 040ef57 commit 67f7d7c

5 files changed

Lines changed: 80 additions & 16 deletions

File tree

.github/workflows/crystal.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Crystal CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 0 * * *'
8+
9+
jobs:
10+
check_format:
11+
runs-on: ubuntu-latest
12+
container: crystallang/crystal
13+
steps:
14+
- name: Check out repository code
15+
uses: actions/checkout@v2
16+
17+
- name: Install dependencies
18+
run: shards install --ignore-crystal-version
19+
20+
- name: Check format
21+
run: crystal tool format --check
22+
check_ameba:
23+
runs-on: ubuntu-latest
24+
container: crystallang/crystal
25+
steps:
26+
- name: Check out repository code
27+
uses: actions/checkout@v2
28+
29+
- name: Install dependencies
30+
run: shards install --ignore-crystal-version
31+
32+
- name: Check ameba
33+
run: ./bin/ameba
34+
test:
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
crystal: ["crystallang/crystal", "crystallang/crystal:nightly"]
39+
container: ${{ matrix.crystal }}
40+
# Service containers to run with `container-job`
41+
services:
42+
# Label used to access the service container
43+
postgres:
44+
# Docker Hub image
45+
image: postgres
46+
# Provide the password for postgres
47+
env:
48+
POSTGRES_PASSWORD: postgres
49+
# Set health checks to wait until postgres has started
50+
options: >-
51+
--health-cmd pg_isready
52+
--health-interval 10s
53+
--health-timeout 5s
54+
--health-retries 5
55+
steps:
56+
# Downloads a copy of the code in your repository before running CI tests
57+
- name: Check out repository code
58+
uses: actions/checkout@v2
59+
60+
# Performs a clean installation of all dependencies in the `shard.yml` file
61+
- name: Install dependencies
62+
run: shards install --ignore-crystal-version
63+
64+
- name: Run tests
65+
run: crystal spec
66+
env:
67+
POSTGRES_HOST: postgres
68+
POSTGRES_PORT: 5432
69+
POSTGRES_USER: postgres
70+
POSTGRES_PASSWORD: postgres
71+
POSTGRES_DB: postgres

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Cache::PostgresCacheStore
22

3-
[![Build Status](https://travis-ci.org/crystal-cache/postgres_cache_store.svg?branch=main)](https://travis-ci.org/crystal-cache/postgres_cache_store)
3+
![Crystal CI](https://github.com/crystal-cache/postgres_cache_store/workflows/Crystal%20CI/badge.svg)
44
[![GitHub release](https://img.shields.io/github/release/crystal-cache/postgres_cache_store.svg)](https://github.com/crystal-cache/postgres_cache_store/releases)
55

66
A [cache](https://github.com/crystal-cache/cache) store implementation which stores everything in the Postgres database,

shard.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: postgres_cache_store
22
description: Cache::Store implementation backed by a database via crystal-pg.
3-
version: 0.2.2
3+
version: 0.2.3
44

55
authors:
66
- Anton Maminov <anton.maminov@gmail.com>
@@ -18,5 +18,6 @@ dependencies:
1818
development_dependencies:
1919
ameba:
2020
github: crystal-ameba/ameba
21+
branch: develop
2122

2223
license: MIT

spec/postgres_cache_store_spec.cr

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,12 @@ describe Cache::PostgresCacheStore do
151151
end
152152

153153
def pg
154-
# psql -c 'CREATE DATABASE postgres_cache_store_test;' -U postgres
155-
DB.open("postgres://postgres@localhost/postgres_cache_store_test")
154+
postgres_user = ENV["POSTGRES_USER"]? || "postgres"
155+
postgres_password = ENV["POSTGRES_PASSWORD"]? || ""
156+
postgres_host = ENV["POSTGRES_HOST"]? || "localhost"
157+
postgres_db = ENV["POSTGRES_DB"]? || "postgres"
158+
159+
DB.open("postgres://#{postgres_user}:#{postgres_password}@#{postgres_host}/#{postgres_db}")
156160
end
157161

158162
def table_name

0 commit comments

Comments
 (0)