IMproving ranking (#33) #19
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: Django CI | |
on: | |
push: | |
branches: [ "main", "22-implement-github-actions" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: github_actions | |
ports: | |
- 5432:5432 | |
# needed because the postgres container does not provide a healthcheck | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Creating calories_tracker database | |
run: | | |
docker exec ${{ job.services.postgres.id }} bash -c "PGPASSWORD=postgres createdb -h localhost -U postgres calories_tracker" | |
- name: Wait for PostgreSQL | |
run: | | |
until pg_isready -h localhost -p 5432; do | |
echo "Waiting for PostgreSQL to become ready..." | |
sleep 2 | |
done | |
- name: Install python dependencies ${{ matrix.python-version }} and other packages | |
run: | | |
sudo apt-get install python3.11 python3.11-venv exiftool | |
sudo python3.11 -m venv .python3.11 | |
sudo .python3.11/bin/pip install . | |
- name: Run Tests | |
run: | | |
sudo .python3.11/bin/python manage.py test |