-
Notifications
You must be signed in to change notification settings - Fork 3
111 lines (100 loc) · 2.95 KB
/
flow_climate_build_production.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: FlowClimateBuild
on:
push:
branches: [main]
jobs:
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.6
- name: Ruby gem cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install gems
run: |
gem update --system --no-document
bundle config path vendor/bundle
bundle install --without development --jobs 4 --retry 3
spa:
name: SPA
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
with:
node-version-file: 'app/spa/.nvmrc'
- name: Run SPA tests
run: |
cd app/spa
npm install
npm run build
npm run test
tests:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
env:
POSTGRES_DB: flowcontrol_test
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'postgres'
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.6
- name: Ruby gem cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install gems
run: |
gem update --system --no-document
bundle config path vendor/bundle
bundle install --without development --jobs 4 --retry 3
- name: Run specs
env:
secret_key_32_encoded: "8L+WeHTWhNtEAvQzoRaYqYtl4VCwDMReh2SzicO/iCA=\n"
encryption_service_salt: ${{ secrets.ENCRYPTION_SERVICE_SALT }}
secret_key_base: ${{ secrets.SECRET_KEY_BASE }}
RAILS_ENV: test
PG_HOST: localhost
PG_USER: 'postgres'
PG_PASSWORD: 'postgres'
PG_PORT: ${{ job.services.postgres.ports['5432'] }}
TEST_ENV_NUMBER: 2
run: |
bundle exec rake parallel:setup
bundle exec rake parallel:spec
deploy-production:
runs-on: ubuntu-latest
needs: [linters, tests, spa]
steps:
- uses: actions/checkout@v2
- uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: 'flowclimateapp'
heroku_email: '[email protected]'
branch: 'main'