Merge pull request #433 from owencompher/main #326
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: Test | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
pytest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.x"] | |
flask-version: ["2.0.3", "latest"] | |
database-uri: | |
- "postgresql://testuser:testpw@localhost/testdb" | |
- "sqlite://" | |
name: "pytest: Python ${{ matrix.python-version }}, Flask ${{ matrix.flask-version }}, postgres=${{ contains(matrix.database-uri, 'postgres') }}" | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: testuser | |
POSTGRES_PASSWORD: testpw | |
POSTGRES_DB: testdb | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
DATABASE_URI: ${{ matrix.database-uri }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install specific Flask version | |
if: ${{ matrix.flask-version != 'latest' }} | |
run: pip install Flask==${{ matrix.flask-version }} | |
- name: Install dependencies | |
run: pip install -e .[test] | |
- name: Install psycopg2 | |
if: ${{ contains(matrix.database-uri, 'postgres') }} | |
run: pip install psycopg2 | |
- name: Run pytest | |
run: coverage run -m pytest | |
- name: Upload coverage to Codecov | |
if: ${{ always() }} | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false |