-
Notifications
You must be signed in to change notification settings - Fork 5
68 lines (60 loc) · 1.55 KB
/
migrations.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
name: Migrations
env:
RAILS_ENV: test
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
jobs:
migrations:
timeout-minutes: 30
runs-on: ubuntu-20.04
services:
postgres:
image: postgres:11
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: ox_exercises
POSTGRES_PASSWORD: ox_exercises
redis:
image: redis
ports:
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Clone repo and checkout merge commit parent (PR target commit)
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: git checkout HEAD^
# Install ruby
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
# Create data to be migrated and revert to PR merge commit
- name: Create data to be migrated
run: |
bin/rake db:create db:schema:load db:seed --trace
bin/rails runner '10.times { FactoryBot.create :exercise }'
git checkout --force -
# Install PR ruby version
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
# Migrate the data
- name: Migrate
run: bin/rake db:migrate