-
-
Notifications
You must be signed in to change notification settings - Fork 103
63 lines (56 loc) · 1.51 KB
/
test.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
name: actions
on:
push:
branches:
- main
pull_request:
branches:
- "*"
# Allows you to run this workflow manually from the Actions tab
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
env:
DATABASE_HOST: localhost
DATABASE_USER: postgres
DATABASE_PASSWORD: password
DATABASE_PORT: 5432
TZ: Asia/Tokyo
services:
db:
image: postgres:10.4-alpine
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
steps:
- name: ☑️ Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: 💎 Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: 🧪 Prepare DB
run: |
bundle exec rails db:create
bundle exec rails db:setup
- name: 🔧 Test
run: bundle exec rspec spec
deploy:
needs: test
if: github.ref == 'refs/heads/main'
# TODO: This workflows depend on Ubuntu version.
# https://github.com/AkhileshNS/heroku-deploy/issues/186
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: akhileshns/[email protected]
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}