-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.51 KB
/
fly.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
name: Build and deploy
on: push
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
DOCKER_BUILDKIT: '1'
jobs:
rspec:
name: Run rspec
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Setup Database
run: |
cp config/database.github-actions.yml config/database.yml
bundle exec rails db:create
bundle exec rails db:schema:load
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Run RSpec
run: |
bundle exec rails assets:precompile
COVERAGE=true bundle exec rspec
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
deploy:
environment: fly-deploy
if: github.ref == 'refs/heads/main'
# needs: [rspec]
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy