Skip to content

Commit

Permalink
fix: strip chr prefix for grch38 (#10)
Browse files Browse the repository at this point in the history
- Adapted docker build and github actions
- Performed isort
- Update to Django 3.2 and Python 3.10
  • Loading branch information
stolpeo committed Feb 2, 2024
1 parent a754e25 commit 15c6dad
Show file tree
Hide file tree
Showing 30 changed files with 315 additions and 148 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
name: CI

on: [push]
on:
- push
- pull_request

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- 3.6
- 3.7
- 3.8
- 3.9

steps:
- name: Install Python via conda.
uses: s-weigand/setup-conda@v1
with:
python-version: ${{ matrix.python-version }}
conda-channels: defaults,bioconda,conda-forge
- name: Install mamba.
run: conda install -y mamba
Expand All @@ -29,7 +21,6 @@ jobs:
uses: actions/checkout@v2
- name: Install project Python dependencies
run: |
pip install -r requirements/local.txt
pip install -r requirements/test.txt
- name: Run tests
run: |
Expand All @@ -43,4 +34,3 @@ jobs:
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.xml
if: ${{ matrix.python-version == '3.7' }}
52 changes: 52 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This workflow is run as part of CI to test that they run through.
#
# The images are pushed to `ghcr.io` for each PR and branch. The ones for
# the releases are pushed in `release-please.yml`.
name: Docker Build

on:
- push
- pull_request

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Write VERSION file for Python package
run: |
git describe --all | tee VERSION
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: utils/docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
19 changes: 19 additions & 0 deletions .github/workflows/docker-cleanup-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Cleanup PR Images

on:
pull_request:
types:
- closed

jobs:
purge-image:
name: Delete PR images
runs-on: ubuntu-latest
steps:
- uses: bots-house/ghcr-delete-image-action@v1.1.0
with:
owner: varfish-org
name: cadd-rest-api
token: ${{ secrets.GITHUB_TOKEN }}
tag: pr-${{github.event.pull_request.number}}
continue-on-error: true
18 changes: 18 additions & 0 deletions .github/workflows/docker-cleanup-untagged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Cleanup Untagged Images

on:
workflow_dispatch:
schedule:
- cron: "0 0 * * SUN"

jobs:
delete-untagged-images:
name: Delete untagged images
runs-on: ubuntu-latest
steps:
- uses: bots-house/ghcr-delete-image-action@v1.1.0
with:
owner: varfish-org
name: cadd-rest-api
token: ${{ secrets.GITHUB_TOKEN }}
untagged-keep-latest: 3
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/VERSION

# SQLite database.
/*.db

Expand Down
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
SHELL = /bin/bash
MANAGE = time python manage.py

.PHONY: black serve _migrate migrate celery

.PHONY: black
black:
black -l 100 --exclude '/(\.eggs|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.?v?env|_build|buck-out|build|dist|src)/' .

.PHONY: isort
isort:
isort --force-sort-within-sections --profile=black .

.PHONY: flake8
flake8:
flake8

.PHONY: serve
serve:
$(MANAGE) runserver

.PHONY: _migrate
_migrate:
$(MANAGE) makemigrations
$(MANAGE) migrate

.PHONY: migrate
migrate: _migrate black

.PHONY: celery
celery:
celery worker -A config.celery_app -l info --concurrency=4

.PHONY: test
test:
$(MANAGE) test --settings=config.settings.test -v2

2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Or:

.. code-block:: bash
$ docker build . --build-arg app_git_tag=v0.3.2 -t bihealth/cadd-rest-api:0.3.2-0
$ docker build . --build-arg app_git_tag=v0.3.2 -t varfish-org/cadd-rest-api:0.3.2-0
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""

from django.conf import settings
from django.db import migrations

Expand Down
1 change: 1 addition & 0 deletions config/celery.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os

from celery import Celery

# set the default Django settings module for the 'celery' program.
Expand Down
2 changes: 1 addition & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
# Django Admin URL.
ADMIN_URL = "admin/"
# https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = [("""Oliver Stolpe""", "oliver.stolpe@bihealth.de")]
ADMINS = [("""Oliver Stolpe""", "oliver.stolpe@bih-charite.de")]
# https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS

Expand Down
2 changes: 1 addition & 1 deletion config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email
DEFAULT_FROM_EMAIL = env(
"DJANGO_DEFAULT_FROM_EMAIL", default="CADD REST API <noreply@bihealth.org>"
"DJANGO_DEFAULT_FROM_EMAIL", default="CADD REST API <noreply@bih-charite.org>"
)
# https://docs.djangoproject.com/en/dev/ref/settings/#server-email
SERVER_EMAIL = env("DJANGO_SERVER_EMAIL", default=DEFAULT_FROM_EMAIL)
Expand Down
3 changes: 1 addition & 2 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf import settings
from django.conf.urls import url
from django.conf.urls import include
from django.conf.urls import include, url
from django.conf.urls.static import static

urlpatterns = [url(r"", include("restapi.urls"))] + static(
Expand Down
1 change: 1 addition & 0 deletions config/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
framework.
"""

import os
import sys

Expand Down
42 changes: 0 additions & 42 deletions docker/Dockerfile

This file was deleted.

14 changes: 0 additions & 14 deletions docker/build-docker.sh

This file was deleted.

Empty file removed environment.yaml
Empty file.
39 changes: 20 additions & 19 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
pytz==2019.2 # https://github.com/stub42/pytz
python-slugify==3.0.3 # https://github.com/un33k/python-slugify
Pillow==6.1.0 # https://github.com/python-pillow/Pillow
argon2-cffi==19.1.0 # https://github.com/hynek/argon2_cffi
redis==3.3.8 # https://github.com/antirez/redis
celery==4.3.1 # pyup: < 5.0 # https://github.com/celery/celery
django-celery-beat==1.5.0 # https://github.com/celery/django-celery-beat
pytz
python-slugify
Pillow
argon2-cffi
redis
celery

Werkzeug==0.14.1 # pyup: < 0.15 # https://github.com/pallets/werkzeug
Sphinx==2.2.0 # https://github.com/sphinx-doc/sphinx
Werkzeug
Sphinx

# Django
# ------------------------------------------------------------------------------
django<2.0 # pyup: < 3.0 # https://www.djangoproject.com/
django-environ==0.4.5 # https://github.com/joke2k/django-environ
django-model-utils==3.2.0 # https://github.com/jazzband/django-model-utils
django-allauth==0.40.0 # https://github.com/pennersr/django-allauth
django-crispy-forms==1.7.2 # https://github.com/django-crispy-forms/django-crispy-forms
django-redis==4.10.0 # https://github.com/niwinz/django-redis
django-debug-toolbar==2.0 # https://github.com/jazzband/django-debug-toolbar
#django==3.2
django<4
django-environ
django-model-utils
django-allauth
django-crispy-forms
django-redis
django-debug-toolbar

# Django REST Framework
djangorestframework==3.10.3 # https://github.com/encode/django-rest-framework
coreapi==2.3.3 # https://github.com/core-api/python-client
djangorestframework
coreapi

jsonfield==2.1.1
jsonfield
ipdb
3 changes: 0 additions & 3 deletions requirements/local.txt

This file was deleted.

6 changes: 3 additions & 3 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

-r ./base.txt

gunicorn==19.9.0 # https://github.com/benoitc/gunicorn
Collectfast==1.0.0 # https://github.com/antonagestam/collectfast
gunicorn
Collectfast

# Django
# ------------------------------------------------------------------------------
django-anymail[mailgun]==6.1.0 # https://github.com/anymail/django-anymail
django-anymail[mailgun]
25 changes: 13 additions & 12 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@

# Testing
# ------------------------------------------------------------------------------
mypy==0.720 # https://github.com/python/mypy
pytest==5.1.2 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.2 # https://github.com/Frozenball/pytest-sugar
mypy
pytest
pytest-sugar

# Code quality
# ------------------------------------------------------------------------------
flake8==3.7.8 # https://github.com/PyCQA/flake8
coverage==4.5.4 # https://github.com/nedbat/coveragepy
black==19.3b0 # https://github.com/ambv/black
pylint-django==2.0.11 # https://github.com/PyCQA/pylint-django
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
flake8
coverage
black
pylint-django
pylint-celery

# Django
# ------------------------------------------------------------------------------
factory-boy==2.12.0 # https://github.com/FactoryBoy/factory_boy
factory-boy

django-extensions==2.2.1 # https://github.com/django-extensions/django-extensions
django-coverage-plugin==1.6.0 # https://github.com/nedbat/django_coverage_plugin
pytest-django==3.5.1 # https://github.com/pytest-dev/pytest-django
django-extensions
django-coverage-plugin
django-test-plus
pytest-django
Loading

0 comments on commit 15c6dad

Please sign in to comment.