-
Notifications
You must be signed in to change notification settings - Fork 17
135 lines (119 loc) · 3.83 KB
/
end-to-end.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
name: End to end testing
on:
push:
branches:
- "**"
- "!master"
jobs:
quality-control:
runs-on: ubuntu-20.04
env:
PG_USER: datapass
PG_PASSWORD: datapass
PG_DATABASE: datapass
services:
redis:
image: redis
ports:
- 6379:6379
postgres:
image: postgres:12.12
env:
POSTGRES_USER: ${{ env.PG_USER }}
POSTGRES_PASSWORD: ${{ env.PG_PASSWORD }}
POSTGRES_DB: ${{ env.PG_DATABASE }}
ports:
- 5432:5432
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v3
- name: Override INSEE dotenv info
run: |
echo "INSEE_HOST=https://api.insee.fr" >> .env
echo "INSEE_CONSUMER_KEY=${{ secrets.INSEE_CONSUMER_KEY }}" >> .env
echo "INSEE_CONSUMER_SECRET=${{ secrets.INSEE_CONSUMER_SECRET }}" >> .env
- name: Load dotenv
uses: falti/[email protected]
with:
log-variables: true
export-variables: true
keys-case: bypass
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
working-directory: backend
- name: Install postgres client
run: sudo apt-get install libpq-dev
- name: Link libffi7 to libffi6 since the version 6 is not available anymore in Ubuntu 20.04
run: sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7 /usr/lib/x86_64-linux-gnu/libffi.so.6
- name: Cache backend dependencies
uses: actions/cache@v3
with:
path: backend/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install backend dependencies
run: |
gem install bundler
bundle config path vendor/bundle
bundler install --jobs 4 --retry 3
working-directory: backend
- name: Cache frontend dependencies
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install frontend dependencies
run: npm install
working-directory: frontend
- name: Create and seed database
run: bin/rails db:create:all db:schema:load db:seed
working-directory: backend
- name: Install Cypress
run: npm install cypress@12
working-directory: .
- name: Install foreman to run local app
run: gem install foreman
working-directory: .
- name: Run applications
run: ./bin/local_dev.sh &
working-directory: .
env:
INSEE_HOST: https://api.insee.fr
INSEE_CONSUMER_KEY: ${{ secrets.INSEE_CONSUMER_KEY }}
INSEE_CONSUMER_SECRET: ${{ secrets.INSEE_CONSUMER_SECRET }}
- name: Wait for backend application to run
run: npx wait-on tcp:3001 -t 30000
- name: Wait for frontend application to run
run: npx wait-on tcp:3000 -t 30000
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: chrome
install: false
working-directory: .
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
- uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-videos
path: cypress/videos