-
Notifications
You must be signed in to change notification settings - Fork 9
106 lines (103 loc) · 3.24 KB
/
e2e.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
name: E2E tests
on:
push:
branches: [master]
pull_request:
env:
MIX_ENV: e2e
jobs:
e2e-tests:
name: E2E Tests
timeout-minutes: 30
runs-on: ubuntu-20.04
env:
DATABASE_HOST: localhost
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
services:
postgres:
image: postgis/postgis:13-3.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: database_test
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: rokroskar/[email protected]
if: "github.ref != 'refs/heads/master'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Install system dependencies
run: |
sudo apt-get install -y imagemagick
- uses: actions/[email protected]
- name: Copy config templates
working-directory: "config"
run: |
cp e2e.local.exs.example e2e.local.exs
- name: Set up Elixir
uses: erlef/[email protected]
with:
elixir-version: "1.12.2" # Define the elixir version [required]
otp-version: "24.0" # Define the OTP version [required]
- name: Restore deps cache
uses: actions/[email protected]
with:
path: deps
key: ${{ runner.os }}-deps-v1-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-deps-v1-
- name: Install dependencies
run: mix deps.get
- name: Set up node
uses: actions/[email protected]
with:
node-version: "15"
- name: Restore npm cache
uses: actions/[email protected]
with:
path: assets/node_modules
key: ${{ runner.os }}-npm-v2-${{ hashFiles('assets/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-v2
- name: Install NodeJS deps
run: npm ci
working-directory: ./assets
- run: npm run deploy
working-directory: ./assets
- name: Restore npm cache
uses: actions/[email protected]
with:
path: e2e/node_modules
key: ${{ runner.os }}-npm-v2-${{ hashFiles('e2e/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-v2
- name: Install NodeJS deps
run: npm ci
working-directory: ./e2e
- name: Migrate database
run: mix do ecto.create, ecto.migrate
- uses: nanasess/setup-chromedriver@master
- name: Lint tests
run: cd e2e && npm run lint
- name: Run tests
run: |
mix phx.server &
cd e2e
npx wait-on -d 60000 -i 5000 --httpTimeout 300000 http://localhost:4002
npx cypress run --browser chrome --headless
- name: Upload artifacts (screenshots)
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: cypress screenshots
path: e2e/cypress/screenshots/
- name: Upload artifacts (downloads)
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: cypress downloads
path: e2e/cypress/downloads/