Skip to content

General car renting fixes #402

General car renting fixes

General car renting fixes #402

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# This is a somewhat modified version
name: Tests v.2
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Create absolute path symlink
run: |
sudo mkdir -p /workspaces
sudo rm -f /workspaces/WebWebWeb
sudo ln -s "$GITHUB_WORKSPACE" /workspaces/WebWebWeb
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8 (might not be needed)
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The current settings we use for black-formatter has 120 line length
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=121 --statistics
- name: Prepare pytest asset directories
run: |
mkdir -p /workspaces/WebWebWeb/pytest-assets/documents
mkdir -p /workspaces/WebWebWeb/pytest-assets/albums
mkdir -p /workspaces/WebWebWeb/pytest-assets/assets
- name: Run tests with pytest
env:
TEST_DATABASE_URL: postgresql+psycopg://postgres:postgres@localhost:5432/postgres_test
TEST_REDIS_URL: redis://localhost:6379/0
ENVIRONMENT: "testing"
USER_MANAGER_SECRET: "test_secret"
run: pytest -v