-
Notifications
You must be signed in to change notification settings - Fork 2
158 lines (139 loc) · 5.2 KB
/
testing-pipline.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
name: Integration-test
on:
push:
branches:
- master
paths:
- "CodeListLibrary_project/**"
pull_request:
branches:
- master
- Development
paths:
- "CodeListLibrary_project/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
pre-deploy-test:
env:
working-directory: ./concept-library
runs-on:
labels: [self-hosted, linux, x64]
group: heavy
strategy:
max-parallel: 4
matrix:
python-version: [3.11]
services:
db:
image: postgres
env:
POSTGRES_DB: concept_library
POSTGRES_USER: clluser_test
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- run: |
sudo apt-get update
sudo apt-get install -y libgconf-2-4 libatk1.0-0 libatk-bridge2.0-0 libgdk-pixbuf2.0-0 libgtk-3-0 libgbm-dev libnss3-dev libxss-dev libasound2
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
- uses: browser-actions/setup-chrome@v1
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docker/requirements/test.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install LDAP files
run: |
sudo apt-get install -y -q libsasl2-dev libldap2-dev libssl-dev libpq-dev
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager --default-timeout 100 -r docker/requirements/test.txt
- name: Prepare Selenium
uses: nanasess/setup-chromedriver@v2
- name: Run Browser
run: |
chrome --version
- name: Run chromedriver
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: Run application
run: |
export $(grep -v '^#' docker/.env/remote.test.env | xargs)
cd CodeListLibrary_project
python manage.py runserver 0.0.0.0:8000 > /dev/null &
- name: Run tests
run: |
export $(grep -v '^#' docker/.env/remote.test.env | xargs)
cd CodeListLibrary_project
pytest -vv -s --random-order --cov-report xml --cov . --html=report.html --self-contained-html --alluredir=./clinicalcode/tests/allure-results
env:
DISPLAY: ":99"
- name: Coverage report
if: always()
uses: 5monkeys/cobertura-action@v13
with:
path: CodeListLibrary_project/coverage.xml
minimum_coverage: 25
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: CodeListLibrary_project/report.html
retention-days: 5
- name: Get Allure history
uses: actions/checkout@v3
if: (success() || failure()) && github.event_name != 'pull_request'
continue-on-error: true
with:
ref: testing-result-pages
path: testing-result-pages
- name: Allure report action # Step to generate Allure report
if: (success() || failure()) && github.event_name != 'pull_request'
uses: simple-elf/allure-report-action@v1.7
with:
allure_results: CodeListLibrary_project/clinicalcode/tests/allure-results
allure_report: CodeListLibrary_project/clinicalcode/tests/allure-report
allure_history: allure-history
gh_pages: testing-result-pages
report_url: https://meek-florentine-a03d43.netlify.app
keep_reports: 15 # Specify the number of previous reports to keep
- name: Upload an artifact files for record
uses: actions/upload-pages-artifact@v2
if: (success() || failure()) && github.event_name != 'pull_request'
with:
name: allure-report
path: CodeListLibrary_project/clinicalcode/tests/allure-report
- name: Publish to Netlify
uses: nwtgck/actions-netlify@v3.0
if: (success() || failure()) && github.event_name != 'pull_request'
with:
publish-dir: './allure-history'
production-deploy: true
deploy-message: 'Deployed to https://meek-florentine-a03d43.netlify.app'
env:
NETLIFY_SITE_ID: ${{secrets.NETLIFY_SITE_ID}}
NETLIFY_AUTH_TOKEN: ${{secrets.NETLIFY_AUTH_TOKEN}}
timeout-minutes: 1
- name: Deploy report to gh-pages branch
if: (success() || failure()) && github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v2
env:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: testing-result-pages
PUBLISH_DIR: allure-history
with:
keepFiles: true