Fix issue in ci.yml #14
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 | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
# Docker Hub image | |
image: postgres:11 | |
# Provide the password for postgres | |
env: | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: redis | |
# Set health checks to wait until redis has started | |
ports: | |
# Maps port 6379 on service container to the host | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
message-db: | |
image: ethangarofolo/message-db:1.2.6 | |
ports: | |
- 5433:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
poetry config virtualenvs.create false | |
poetry install --with dev,test --all-extras | |
- name: Wait for PostgreSQL to be ready | |
run: | | |
for i in {1..30}; do | |
if pg_isready -h localhost -p 5432; then | |
break | |
fi | |
echo "Waiting for PostgreSQL..." | |
sleep 1 | |
done | |
- name: Set up database | |
run: | | |
chmod +x ./tests/create_db.sh | |
./tests/create_db.sh | |
- name: Run Ruff | |
run: ruff check --output-format=github . | |
- name: Test with pytest | |
run: | | |
pytest tests/lending/ tests/catalogue/ | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |