This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
153 lines (105 loc) · 3.14 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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# cspell:words akhileshns
name: CI
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '0 9 * * 1-5'
env:
TF_VERSION: 1.5.4
jobs:
test:
runs-on: ubuntu-20.04
timeout-minutes: 10
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: 'password'
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@main
- uses: nanasess/setup-chromedriver@master
- uses: ruby/setup-ruby@master
with:
bundler-cache: true
- uses: actions/setup-node@main
with:
cache: yarn
node-version-file: .nvmrc
- run: ./bin/setup
- run: RAILS_ENV=test ./bin/rails assets:precompile
- run: ./bin/test
- run: ./bin/quality
- name: Run git diff
run: if [[ $(git status --porcelain) != '' ]]; then git status; git diff; exit 1; fi
spellcheck:
runs-on: ubuntu-20.04
timeout-minutes: 1
steps:
- uses: actions/checkout@main
- uses: streetsidesoftware/cspell-action@main
with:
files: '**'
incremental_files_only: false
terraform:
runs-on: ubuntu-20.04
timeout-minutes: 1
defaults:
run:
working-directory: terraform/app_environment
steps:
- uses: actions/checkout@main
- uses: hashicorp/setup-terraform@main
with:
terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false
- run: terraform fmt -check -recursive
- run: terraform init -backend=false
- run: terraform validate
- name: Run git diff
run: if [[ $(git status --porcelain) != '' ]]; then git status; git diff; exit 1; fi
deployTerraform:
needs: [test, spellcheck, terraform]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
concurrency: serial
timeout-minutes: 10
defaults:
run:
working-directory: terraform/app_environment
env:
TF_WORKSPACE: production
steps:
- uses: actions/checkout@main
- uses: hashicorp/setup-terraform@main
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_version: ${{ env.TF_VERSION }}
terraform_wrapper: false
- run: terraform init
- run: terraform apply -lock-timeout=30s
- name: Run git diff
run: if [[ $(git status --porcelain) != '' ]]; then git status; git diff; exit 1; fi
deployHeroku:
needs: [deployTerraform]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-20.04
concurrency: serial
timeout-minutes: 10
steps:
- uses: actions/checkout@main
- uses: akhileshns/heroku-deploy@master
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }}-production
heroku_email: ${{ secrets.HEROKU_EMAIL }}
- name: Run git diff
run: if [[ $(git status --porcelain) != '' ]]; then git status; git diff; exit 1; fi