Skip to content

Switch from flake8 to ruff, reformat all missing files #16

Switch from flake8 to ruff, reformat all missing files

Switch from flake8 to ruff, reformat all missing files #16

Workflow file for this run

on:
push:
branches:
- main
pull_request:
name: CI
jobs:
test:
runs-on: ubuntu-latest
name: Test
env:
DJANGO_DEBUG: 'True'
PORT: '8000'
DATABASE_URL: 'postgres://pg:passw0rd@localhost/reservation-api'
services:
postgres:
image: postgres:13.2-alpine
env:
POSTGRES_USER: pg
POSTGRES_PASSWORD: passw0rd
POSTGRES_DB: reservation-api
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
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run migrations
run: ./manage.py migrate
- name: Collect static files
run: ./manage.py collectstatic --noinput
- name: Install dev dependencies
run: |
pip install -r requirements-dev.txt
- name: Run pytest
run: pytest
docker_image:
name: Build Docker image
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- name: Build Docker image
run: |
docker build \
--no-cache \
-t coredump/reservation-api:main \
-t coredump/reservation-api:latest \
.
- name: Push Docker image (only on main)
if: github.ref == 'refs/heads/main'
run: |
docker login -u "${{ secrets.DOCKER_USERNAME }}" -p "${{ secrets.DOCKER_PASSWORD }}" && \
docker push -a coredump/reservation-api