This repository was archived by the owner on Dec 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (67 loc) · 2.25 KB
/
test-linux.yml
File metadata and controls
81 lines (67 loc) · 2.25 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
---
name: test-linux
"on":
push: {}
jobs:
python:
runs-on: ubuntu-latest
strategy:
matrix:
# os: [ubuntu-latest, ubuntu-22.04]
python-version: ["3.8", "3.9", "3.10"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Reload Cache / pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install requirements
run: |
make _deps
pip install -r db/requirements.txt
- name: Start database
run: |
sudo service postgresql start
sudo -u postgres psql -c 'CREATE DATABASE nt'
sudo -u postgres psql -c 'CREATE ROLE runner'
sudo -u postgres psql -c "ALTER USER runner PASSWORD 'password'"
sudo -u postgres psql -c 'ALTER USER runner WITH LOGIN SUPERUSER'
sudo -u postgres psql -c 'ALTER DATABASE nt OWNER TO runner'
psql -d nt -c 'ALTER DATABASE nt SET search_path TO nt'
psql -l
# This package uses relative imports, so can be called from outside
python -m db.sql rebuild
# Select versions (not a pass/fail test, but still viewable in logs)
psql -d nt -c 'SELECT * FROM version'
- name: Run Tests
run: make _test
- name: Run linters
run: make _lint
- name: Start server
run: source .env && make _run &
# NOTE: depends on API_PORT=20000
- name: Integration test / basic request / 10 second startup
run: |
n=0
set +e
while [ $n != 20 ]; do
n=$(expr $n + 1)
echo $n
sleep 0.5
curl localhost:20000 && break
done;
set -e
# Do some basic validation, that we get HTTP 2XX/3XX & valid JSON
curl -I -X GET localhost:20000
curl localhost:20000/pg/version | jq
curl localhost:20000/nutrients | jq