fix: status page script #2426
Workflow file for this run
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: CI | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
paths-ignore: | |
- "README.md" | |
# - ".github/workflows/**" | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: "username" | |
POSTGRES_PASSWORD: "password" | |
POSTGRES_DB: "test" | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Copy env file | |
run: cp .env.sample .env | |
- name: Run app | |
run: | | |
python3 main.py & | |
pid=$! | |
sleep 10 | |
if ps -p $pid > /dev/null; then | |
echo "main.py started successfully" | |
kill $pid | |
else | |
echo "main.py failed to start" | |
exit 1 | |
fi | |
- name: Run migrations | |
run: | | |
alembic revision --autogenerate | |
alembic upgrade head | |
- name: Run tests | |
run: | | |
PYTHONPATH=. pytest |