-
Notifications
You must be signed in to change notification settings - Fork 9
118 lines (98 loc) · 4.05 KB
/
run_tests_on_pull_request.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
# This workflow will run on pull requests
name: Run Tests on Pull Requests
on:
workflow_dispatch:
branches: [main]
pull_request:
branches: [dev, main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.11.4]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install System Dependencies
run: |
sudo apt-get install cmake protobuf-compiler wget redis-server postgresql nginx
- name: Run System Services
run: |
sudo systemctl enable postgresql
sudo systemctl start postgresql
- name: Create Database Tables
run: |
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'opentera';"
sudo -u postgres psql -c "create database opentera;"
sudo -u postgres psql -c "create user TeraAgent with encrypted password 'tera';"
sudo -u postgres psql -c "grant all privileges on database opentera to TeraAgent;"
sudo -u postgres psql -c "ALTER USER TeraAgent WITH PASSWORD 'tera';"
sudo -u postgres psql -c "create database openteralogs;"
sudo -u postgres psql -c "grant all privileges on database openteralogs to TeraAgent;"
sudo -u postgres psql -c "create database openterafiles;"
sudo -u postgres psql -c "grant all privileges on database openterafiles to TeraAgent;"
sudo -u postgres psql -c "\l"
- name: Install Miniconda3
run: |
echo $HOME
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ./Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3
- name: Run CMake and build
working-directory: teraserver
run: |
cmake .
make python-all
echo "OPENTERA_PYTHON=$(echo $PWD/python/env/python-3.11/bin/python)" >> $GITHUB_ENV
echo "PYTHONPATH=$(echo $PWD/python)" >> $GITHUB_ENV
- name: Generate Self Signed TLS Certificates
working-directory: teraserver/python
run: |
$OPENTERA_PYTHON CreateCertificates.py
- name: Run NGINX Reverse Proxy
working-directory: teraserver/python/config
run: |
mkdir logs
./start_nginx.sh
- name: Start TeraServer With Tests Enabled
working-directory: teraserver/python
run: |
$OPENTERA_PYTHON TeraServer.py --enable_tests=1 &
sleep 10
- name: Run Device API Tests
working-directory: teraserver/python/tests/modules/FlaskModule/API/device
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"
- name: Run Participant API Tests
working-directory: teraserver/python/tests/modules/FlaskModule/API/participant
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"
- name: Run User API Tests
working-directory: teraserver/python/tests/modules/FlaskModule/API/user
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"
- name: Run Service API Tests
working-directory: teraserver/python/tests/modules/FlaskModule/API/service
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"
- name: Run Models Tests
working-directory: teraserver/python/tests/opentera/db/models
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"
- name: Run Service Tests
working-directory: teraserver/python/tests/opentera/services
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"
- name: Run FileTransferService Tests
working-directory: teraserver/python/tests/services/FileTransferService
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"
- name: Run LoggingService Tests
working-directory: teraserver/python/tests/services/LoggingService
run: |
$OPENTERA_PYTHON -m unittest discover . "test_*.py"