-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (104 loc) · 3.47 KB
/
mail.yml
File metadata and controls
128 lines (104 loc) · 3.47 KB
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
name: Run Cypress on pull request to main
on:
pull_request:
branches:
- main
jobs:
setup:
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check if Node.js is installed
run: node --version || echo 'Node.js is not installed'
id: check_node_installed
continue-on-error: true
- name: Install Node.js and npm
if: steps.check_node_installed.outcome == 'failure'
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies in server directory
run: npm install
working-directory: server/
- name: Install dependencies in client directory
run: npm install
working-directory: client/
- name: Check if mongod is running
run: ps aux | grep -v grep | grep mongod || echo 'mongod is not running'
id: check_mongod_running
continue-on-error: true
- name: Run mongod if not running
if: steps.check_mongod_running.outcome == 'failure'
run: mongod --config /opt/homebrew/etc/mongod.conf --fork
- name: Set DB_URL variable
run: echo "DB_URL=mongodb://127.0.0.1:27017/fake_so" >> $GITHUB_ENV
- name: Run remove_db.js
env:
DB_URL: ${{ env.DB_URL }}
run: node remove_db.js $DB_URL
working-directory: server/
- name: Rum jest tests
run: npx jest --maxWorkers=1
working-directory: server/
- name: Start the node server
run: node server.js > server.log 2>&1 &
working-directory: server/
- name: Start the Client
run: npm start &
working-directory: client/
- name: Install testing dependencies
run: npm install cypress
working-directory: client/
- name: Run component tests
run: npx cypress run --component
working-directory: client/
- name: Run e2e tests
run: npx cypress run --e2e
working-directory: client/
- name: Kill the node server process
run: kill $(lsof -t -i:8000) || true
- name: Stop the client process
run: kill $(lsof -t -i:3000) || true
# name: Run Cypress Tests
# on: push
# jobs:
# cypress-run:
# runs-on: [self-hosted]
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Start MongoDB
# run: |
# docker run -d -p 27017:27017 --name mongodb-instance mongo
# - name: Setup Node
# uses: actions/setup-node@v3
# with:
# node-version: '16.15'
# - run: npm install --prefix client
# - run: npm install --prefix server
# - run: npm install --prefix testing
# - run: npm install
# - name: Install Cypress
# run: npm install cypress --save-dev
# - name: Cypress run
# uses: cypress-io/github-action@v5
# with:
# project: ./testing
# start: npm run start --prefix client, npm run start --prefix server
# wait-on: 'http://localhost:3000,http://localhost:8000'
# browser: chrome
# timeout: 400
# - name: Stop and remove MongoDB
# run : |
# docker stop mongodb-instance
# docker rm mongodb-instance
# create-issue:
# runs-on: [self-hosted]
# needs: [cypress-run]
# if: ${{ always() && contains(needs.*.result, 'failure') && github.ref == 'refs/heads/main'}}
# steps:
# - uses: actions/checkout@v3
# - uses: JasonEtco/create-an-issue@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}