wip bug report #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 |