-
Notifications
You must be signed in to change notification settings - Fork 80
129 lines (125 loc) · 4.33 KB
/
ci_e2e_cypress.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
name: e2e cypress
on:
push:
branches:
- production
- development
- staging
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
e2e-cypress:
runs-on: ubuntu-20.04
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.6-amd64
ports:
- 9200/tcp
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
redis:
image: redis:5.0.14
ports:
- 6379:6379
steps:
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.8.0
with:
mongodb-version: 4.2.6
mongodb-replica-set: test-rs
- name: Checkout reposistory
uses: actions/checkout@v3
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Cache node modules
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- name: install dependencies
run: yarn install
- run: sudo apt update
- run: sudo apt-get install poppler-utils
- name: Cache build
id: cache-build
uses: actions/cache@v2
with:
path: ./prod
key: >-
${{ runner.os }}-build-${{ hashFiles('app/**/*.*') }}-
${{ hashFiles('database/**/*.*') }}-
${{ hashFiles('**/yarn.lock') }}-
${{ hashFiles('**/webpack.production.config.js') }}-
${{ hashFiles('**/.babelrc') }}-
${{ hashFiles('webpack/**/config.js') }}-
- name: build production
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn production-build
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Clone dummy services
uses: actions/checkout@v3
with:
repository: huridocs/dummy_extractor_services
path: dummy_extractor_services
- run: python3 -m venv .venv
working-directory: dummy_extractor_services
- run: make install_venv -C dummy_extractor_services
- run: make start -C dummy_extractor_services > logs.log &
- run: sleep 5 && wget --waitretry=5 --retry-connrefused -v http://localhost:5051/info
- name: Log on failure
if: ${{ failure() }}
run: cat dummy_extractor_services/logs.log
- run: yarn blank-state
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
TRANSPILED: true
- run: yarn ix-config
env:
DBHOST: localhost:27017
DATABASE_NAME: uwazi_e2e
- name: start Uwazi
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
DATABASE_NAME: uwazi_e2e
INDEX_NAME: uwazi_e2e
EXTERNAL_SERVICES: true
run: yarn run-production > output.txt &
- name: wait for uwazi to be ready
run: sleep 5 && wget --waitretry=5 --retry-connrefused -v http://localhost:3000/
timeout-minutes: 2
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: chrome
component: false
config-file: cypress.config.ts
timeout-minutes: 25
env:
DBHOST: localhost:27017
ELASTICSEARCH_URL: http://localhost:${{ job.services.elasticsearch.ports[9200] }}
TRANSPILED: true
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: snapshots
path: cypress/e2e/**/__image_snapshots__/
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: video
path: cypress/videos/
- name: Print server output
run: cat output.txt
if: failure()