Prod update #10
Workflow file for this run
This file contains hidden or 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 and run tests with a single version of Python | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Python application | |
| on: | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create test environment file | |
| working-directory: ./app | |
| run: | | |
| echo '${{ secrets.TEST_ENV_FILE }}' > .env.test | |
| - name: Set up Python 3.14 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Install dependencies | |
| working-directory: ./app | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pip-tools | |
| pip-sync | |
| - name: Test database connection | |
| working-directory: ./app | |
| run: | | |
| python -c " | |
| from dotenv import load_dotenv | |
| load_dotenv('.env.test') | |
| import psycopg2 | |
| import os | |
| try: | |
| conn = psycopg2.connect( | |
| host=os.getenv('DB_HOST'), | |
| database=os.getenv('DB_NAME'), | |
| user=os.getenv('DB_USER'), | |
| password=os.getenv('DB_PASSWORD'), | |
| port=os.getenv('DB_PORT') | |
| ) | |
| print('Database connection successful') | |
| conn.close() | |
| except Exception as e: | |
| print(f'Database connection failed: {e}') | |
| exit(1) | |
| " | |
| - name: Test with pytest | |
| working-directory: ./app | |
| run: | | |
| python -m pytest |