-
Notifications
You must be signed in to change notification settings - Fork 38
86 lines (81 loc) · 2.39 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
name: CI
on:
push:
branches:
- master
- develop
tags:
- '*'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- 3.1
postgres_image:
- postgis/postgis:12-3.3
services:
postgres:
image: ${{ matrix.postgres_image }}
env:
POSTGRES_PASSWORD: bety
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby}}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install libraries
run: |
sudo apt-get update
sudo apt-get -y install libgeos-dev
- name: Install gems
run: |
gem install bundler -v 2.3
bundle config path vendor/bundle
bundle config without 'javascript_testing'
bundle config with 'docker'
bundle config
bundle install --jobs 4 --retry 3
- name: Build and test with Rake
env:
RAILS_ENV: test
POSTGRES_PASSWORD: bety
PGPASSWORD: bety
run: |
cp config/database.yml.gh config/database.yml
psql -h localhost -U postgres -c "CREATE USER bety WITH SUPERUSER CREATEDB PASSWORD 'bety'";
psql -h localhost -U postgres -c "DROP DATABASE IF EXISTS test;"
psql -h localhost -U postgres -c "CREATE DATABASE test WITH OWNER bety;"
psql -h localhost -U bety -d test -c "CREATE EXTENSION postgis;"
#bundle exec rails db:create
# bundle exec rails db:migrate
bundle exec rake db:structure:load
bundle exec rake db:fixtures:load
mkdir -p spec/tmp
bundle exec rails test
bundle exec rspec --tag ~js
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build image
run: docker build --tag image --file Dockerfile .