-
-
Notifications
You must be signed in to change notification settings - Fork 4
74 lines (66 loc) · 1.96 KB
/
ruby.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
name: Ruby
on: [push]
jobs:
docker_build:
name: Build Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
- name: Build the Dockerfile
run: docker build -t app .
build:
name: The Build
runs-on: ubuntu-latest
services:
redis:
image: redis:4
ports:
- 6379:6379
postgres:
image: postgres:10
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: 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.5.2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Show available Ruby versions
run: |
ls $RUNNER_TOOL_CACHE/Ruby
uname -a
cat /etc/os-release
- name: Install required packages
run: sudo apt-get install libpq-dev
- name: Test
run: |
RAILS_ENV=test bundle exec rails db:create
RAILS_ENV=test bundle exec rails db:schema:load
bundle exec rake
env:
#Note: DATABASE_URL does not work in TEST env.
TEST_DB_HOST: localhost
TEST_DB_USERNAME: postgres
TEST_DB_PASSWORD: postgres
TEST_DB_NAME: postgres
discourse_sso_secret: "secret"
discourse_endpoint: "https://example.com"
PG_PORT: ${{ job.services.postgres.ports['5432'] }}
#- name: Deploy to server via SSH
#uses: appleboy/ssh-action@master
#with:
#host: ${{ secrets.HOST }}
#key: ${{ secrets.KEY }}
#port: ${{ secrets.PORT }}
#username: ${{ secrets.USERNAME }}
#script: |
#cd smartcitizen-api
#pwd
#./scripts/deploy.sh
#if: github.ref == 'refs/heads/master' && job.status == 'success'