Update python-app.yml #45
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: Python application | |
on: | |
push: | |
branches: | |
- "*" # Run on all branches for any push events | |
pull_request: | |
branches: | |
- "*" # Run on all branches for any pull request events | |
permissions: | |
contents: read | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Set FLASK_APP environment variable | |
run: echo "FLASK_APP=src/server.py" >> $GITHUB_ENV | |
working-directory: ${{ github.workspace }}/PCP/server | |
- name: Start Flask server | |
run: flask run --host=0.0.0.0 & | |
env: | |
FLASK_ENV: development | |
- name: Delay for Flask server to start | |
run: sleep 5 | |
- name: Run unit tests | |
run: | | |
python -m unittest discover tests -v | |
working-directory: ${{ github.workspace }}/PCP/server |