Skip to content

[pre-commit.ci] pre-commit autoupdate (#483) #364

[pre-commit.ci] pre-commit autoupdate (#483)

[pre-commit.ci] pre-commit autoupdate (#483) #364

Workflow file for this run

name: Pytest
on:
push:
branches: ['main']
pull_request:
branches: ['main']
paths:
- '**.py'
- '**.js'
- '**.jinja2'
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
services:
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install project
run: |
pip install -e .
pip install -r test_requirements.txt
- name: Install pytest-github-actions-annotate-failures
run: pip install pytest-github-actions-annotate-failures
- name: Create PostgreSQL databases
run: |
sudo apt-get install postgresql-client -y
echo "Granting database privileges to user $(whoami)"
psql -h localhost -U postgres -c "create user $(whoami);"
psql -h localhost -U postgres -c "create database coaster_test;"
psql -h localhost -U postgres -c "grant all privileges on database coaster_test to $(whoami);"
psql -h localhost -U postgres coaster_test -c "grant all privileges on schema public to $(whoami); grant all privileges on all tables in schema public to $(whoami); grant all privileges on all sequences in schema public to $(whoami);"
- name: Test with pytest
run: |
pytest --showlocals --cov=coaster
- name: Prepare coverage report
run: |
mkdir -p coverage
coverage lcov -o coverage/coaster.lcov
- name: Upload coverage report to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: ./coverage/coaster.lcov
flag-name: python-${{ matrix.python-version }}
parallel: true
finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Publish to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
path-to-lcov: ./coverage/coaster.lcov
parallel-finished: true