fix: update env.py to use SQLALCHEMY_DATABASE_URI from Flask config a… #1420
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
name: Test | |
on: | |
push: | |
pull_request: | |
env: | |
FLASK_ENV: testing | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
services: | |
postgres: | |
image: postgres:12 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: ${{ secrets.TEST_DATABASE_PASSWORD }} | |
POSTGRES_DB: ${{ secrets.TEST_DATABASE_NAME }} | |
POSTGRES_HOST_AUTH_METHOD: trust | |
options: | |
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
ports: | |
- 5432:5432 | |
mongo: | |
image: mongo:4.2.3 | |
env: | |
MONGO_INITDB_ROOT_USERNAME: crane | |
MONGO_INITDB_ROOT_PASSWORD: ${{ secrets.TEST_MONGO_PASSWORD }} | |
ports: | |
- 27017:27017 | |
strategy: | |
matrix: | |
python-version: ["3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
echo "Waiting for PostgreSQL to be ready..." | |
until pg_isready -h localhost -p 5432; do sleep 1; done | |
- name: Install uuid-ossp extension | |
run: | | |
PGPASSWORD=${{ secrets.TEST_DATABASE_PASSWORD }} psql -h localhost -U postgres -d ${{ secrets.TEST_DATABASE_NAME }} -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" | |
- name: Test with pytest | |
env: | |
TEST_DATABASE_URI: ${{ secrets.TEST_DATABASE_URI }} | |
TEST_MONGO_URI: ${{ secrets.TEST_MONGO_URI }} | |
run: | | |
python -m pytest | |
- name: Generate Report | |
env: | |
TEST_DATABASE_URI: ${{ secrets.TEST_DATABASE_URI }} | |
TEST_MONGO_URI: ${{ secrets.TEST_MONGO_URI }} | |
run: | | |
pip install coverage | |
coverage run -m pytest |