-
Notifications
You must be signed in to change notification settings - Fork 1
179 lines (158 loc) ยท 6.2 KB
/
test.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
174
175
176
177
178
179
name: Testing
on: [ push, pull_request ]
env:
EMG_CONFIG: ${{ github.workspace }}/client-repo/ci/config.yaml
API_URL: http://localhost:9000/metagenomics/api/v1/
SEARCH_URL: https://www.ebi.ac.uk/ebisearch/ws/rest/metagenomics_
DEPLOYMENT_SUBFOLDER: /metagenomics
BASE_URL: http://localhost:9000/metagenomics/
INTERPRO_URL: http://www.ebi.ac.uk/interpro/
SEQUENCE_SEARCH_URL: https://wwwdev.ebi.ac.uk/metagenomics/sequence-search/search/phmmer
ENA_URL: https://www.ebi.ac.uk/ena/browser/view/
CYPRESS_WEBIN_USERNAME: Webin-000
CYPRESS_WEBIN_PASSWORD: secret
jobs:
test:
runs-on: ubuntu-latest
services:
mongo:
image: mongo:4.0.6
ports:
- 27017:27017
options: --health-cmd="mongo" --health-interval=10s --health-timeout=5s --health-retries=5
steps:
- uses: actions/checkout@v4
with:
path: client-repo
- name: ๐ - Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: ๐ง๐ฌ - Install EMG API
run: |
pip install --user --upgrade pip setuptools
python -V
pip -V
pip install "git+https://github.com/EBI-metagenomics/emgapi@develop#egg=emgcli"
ls -l
- name: Set up db files for API
working-directory: client-repo
run: |
sed -i s#{GITHUB_WORKSPACE}#$GITHUB_WORKSPACE#g ci/config.yaml
cat ci/config.yaml
- name: ๐ช - Setting up Fixtures
working-directory: client-repo
run: |
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
sudo apt install ./mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb
mongorestore --gzip --archive < ci/testdbs/emg-testdb.mongoarchive
emgcli migrate
mv ci/emg_api_datafiles/results $GITHUB_WORKSPACE/results
- name: โ๏ธ - Settings
working-directory: client-repo
env: # Or as an environment variable
MAPS_KEY: ${{ secrets.GOOGLE_MAPS_DEV_KEY }}
run: |
echo "{\"googleMapsKey\": \"$MAPS_KEY\", \"api\": \"$API_URL\"}" > "$(pwd)/config.private.json"
- uses: actions/checkout@v4
name: ๐ฌ - Checkout EMG API
with:
repository: 'EBI-Metagenomics/emgapi'
ref: 'develop'
path: emgapi
- name: ๐ฌ - Start EMG API
run: |
export PYTHONPATH="$PYTHONPATH:${{ github.workspace }}/emgapi/tests/"
echo $PYTHONPATH
emgcli collectstatic --noinput
emgcli check --deploy
cd emgapi
export GUNICORN_CMD_ARGS="--bind 127.0.0.1:8000 --workers=1 --daemon -p emg.pid --error-logfile error.log --access-logfile access.log"
emgdeploy emgcli.wsgi:application
ps aux | grep emgdeploy
cd ..
echo "\ngunicorn v1/"
curl --silent http://localhost:8000/v1/
- name: ๐ - Setup NginX
working-directory: client-repo
run: |
sudo chmod 777 /var/log/nginx/*
sudo chmod 777 /var/run/*
sudo chmod 777 /var/run
sed -i s#{GITHUB_WORKSPACE}#$GITHUB_WORKSPACE#g ci/nginx.conf
nginx -c "$(pwd)/ci/nginx.conf"
- name: ๐ - Set up JS Node 16
uses: actions/setup-node@v4
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: client-repo/package-lock.json
# TODO: โ ๏ธ the json generated is not understood by codecov
# TODO: fix 404s for nested URLs โ nginx config problem?
- name: ๐ง - Install
working-directory: client-repo
run: |
npm ci
npm run build
npm run coverage:instrument
cp -r dist metagenomics
mv metagenomics /usr/share/nginx/html/metagenomics
cp -r coverage/instrumented/* /usr/share/nginx/html/metagenomics/
ls /usr/share/nginx/html/metagenomics
echo "=== web index ==="
curl --silent http://localhost:9000/metagenomics/
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
- name: ๐งน - ESlint
working-directory: client-repo
run: |
npm run eslint
- name: ๐งช - Testing
uses: cypress-io/github-action@v6
with:
working-directory: client-repo
browser: chrome
- name: ๐ - Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
directory: ${{ github.workspace }}/client-repo/coverage/
# TODO: enable sentry when https://github.com/getsentry/action-release/issues/83 is resolved
# - name: Sentry Release
# uses: getsentry/[email protected]
# working-directory: 'client-repo'
# env:
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
# SENTRY_LOG_LEVEL: 'info'
# with:
# environment: dev
# sourcemaps: './dist/js'
# version: ${{ github.sha }}
- name: ๐ธ - Failed tests snapshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: tests-snapshots
path: /home/runner/work/ebi-metagenomics-client/ebi-metagenomics-client/client-repo/cypress/screenshots/ # - name: ๐ - Coverage
- name: ๐ - Error log
if: failure()
run: |
echo "NGINX error log"
cat /var/log/nginx/error.log
echo "NGINX access log"
cat /var/log/nginx/access.log
- name: ๐ฎ - Slack Notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
env:
SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' }}"
SLACK_USERNAME: 'Github Actions API'
SLACK_ICON_EMOJI: ':octocat:'
SLACK_TITLE: 'webkit results in GitHub Actions'
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: '#metagenomics-notify'
MSG_MINIMAL: Actions URL