-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (149 loc) · 4.61 KB
/
specs.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Tests
on:
pull_request:
types: [review_requested, opened, reopened]
push:
branches:
- main
jobs:
security:
name: Brakeman (Static security)
if: "${{ github.actor != 'dependabot[bot]' }}"
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
cache-version: 336
- name: Run Brakeman
run: bundle exec brakeman -q
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
cache-version: 336
- name: Run RuboCop
run: bundle exec rubocop --parallel
unit-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y postgresql-client libpq-dev
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
cache-version: 336
- name: Run unit tests
env:
RAILS_ENV: test
RAILS_TEST_KEY: ${{ secrets.RAILS_TEST_KEY }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
DATABASE_URL: postgres://postgres:postgres@localhost:5432
run: bin/rails db:setup spec
e2e-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Install packages
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y postgresql-client libpq-dev
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: .ruby-version
bundler-cache: true
cache-version: 321
- name: Run e2e tests
env:
RAILS_ENV: test
RAILS_TEST_KEY: ${{ secrets.RAILS_TEST_KEY }}
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
DATABASE_URL: postgres://postgres:postgres@localhost:5432
run: bin/rails db:setup; bundle exec cucumber
continuous-deployment-sandbox:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- security
- lint
- unit-test
- e2e-test
timeout-minutes: 10
strategy:
matrix:
host: [services1, services2]
fail-fast: false
environment: sandbox
env:
DEPLOY_HTTPS_LOGIN: ${{ secrets.DEPLOY_HTTPS_LOGIN }}
DEPLOY_HTTPS_PASSWORD: ${{ secrets.DEPLOY_HTTPS_PASSWORD }}
DEPLOY_HTTPS_REQUEST_URL: ${{ vars.DEPLOY_HTTPS_REQUEST_URL }}
DEPLOY_HTTPS_RESPONSE_URL: ${{ vars.DEPLOY_HTTPS_RESPONSE_URL }}
DEPLOY_HOST: host_${{ matrix.host }}
DEPLOY_APP: formulaire_qf_sandbox
DEPLOY_BRANCH: ${{ github.ref_name }}
steps:
- name: Download and run deploy script
shell: bash
run: |
git clone https://github.com/etalab/api-entreprise-integration
cd api-entreprise-integration
./deploy-parteprise.sh
continuous-deployment-production:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- security
- lint
- unit-test
- e2e-test
timeout-minutes: 10
strategy:
matrix:
host: [services1, services2]
fail-fast: false
environment: production
env:
DEPLOY_HTTPS_LOGIN: ${{ secrets.DEPLOY_HTTPS_LOGIN }}
DEPLOY_HTTPS_PASSWORD: ${{ secrets.DEPLOY_HTTPS_PASSWORD }}
DEPLOY_HTTPS_REQUEST_URL: ${{ vars.DEPLOY_HTTPS_REQUEST_URL }}
DEPLOY_HTTPS_RESPONSE_URL: ${{ vars.DEPLOY_HTTPS_RESPONSE_URL }}
DEPLOY_HOST: host_${{ matrix.host }}
DEPLOY_APP: formulaire_qf_production
DEPLOY_BRANCH: main
steps:
- name: Download and run deploy script
shell: bash
run: |
git clone https://github.com/etalab/api-entreprise-integration
cd api-entreprise-integration
./deploy-parteprise.sh