-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (68 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
name: Ci
on: [push]
jobs:
verify:
name: Build and deploy
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11.1
env:
POSTGRES_USER: postgres
POSTGRES_DB: hofakker_test
POSTGRES_PASSWORD: ""
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7.3
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.15.0
- name: Install gem files
run: |
gem install bundler -v '2.2.21'
bundle install
- name: Run ruby code linter (Rubocop)
run: bin/rubocop
- name: Run vulnerability scanner (Brakeman)
run: bin/brakeman -q -w2
# - name: Install dependencies
# run: |
# # fix: Unable to fetch some archives
# sudo apt-get update
# sudo apt-get -yqq install libpq-dev chromium-chromedriver
# yarn install
# - name: Setup test database
# env:
# RAILS_ENV: test
# DATABASE_URL: postgres://postgres@localhost:5432/hofakker_test
# run: |
# bin/rails db:create
# bin/rails db:migrate
# - name: Run testsuite (Rspec)
# env:
# RAILS_ENV: test
# DATABASE_URL: postgres://postgres@localhost:5432/hofakker_test
# run: bin/rspec
- name: Deploy to staging environment
if: github.ref == 'refs/heads/develop' && job.status == 'success'
env:
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
HEROKU_APP_NAME: "vereniging-staging"
# Deploy develop to staging app, this will autodeploy master so we have push to origin/develop:master
run: git push --force https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/develop:main
- name: Deploy to production environment
if: github.ref == 'refs/heads/master' && job.status == 'success'
env:
HEROKU_API_TOKEN: ${{ secrets.HEROKU_API_TOKEN }}
HEROKU_APP_NAME: "vereniging-production"
run: git push https://heroku:$HEROKU_API_TOKEN@git.heroku.com/$HEROKU_APP_NAME.git origin/main:main