Browse Source

Add base files for the CI

pull/9/head
Dashie der otter 9 months ago
parent
commit
371217cdc0
Signed by: Dashie <dashie@sigpipe.me> GPG Key ID: C2D57B325840B755
9 changed files with 140 additions and 0 deletions
  1. 2
    0
      .coveragerc
  2. 3
    0
      .dockerignore
  3. 64
    0
      .drone.yml
  4. 3
    0
      .gitignore
  5. 3
    0
      .isort.cfg
  6. 4
    0
      babel.cfg
  7. 12
    0
      pyproject.toml
  8. 10
    0
      setup.cfg
  9. 39
    0
      setup.py

+ 2
- 0
.coveragerc View File

@@ -0,0 +1,2 @@
1
+[run]
2
+omit = tests/*

+ 3
- 0
.dockerignore View File

@@ -0,0 +1,3 @@
1
+.git
2
+LICENSE
3
+README.md

+ 64
- 0
.drone.yml View File

@@ -0,0 +1,64 @@
1
+clone:
2
+  git:
3
+    image: plugins/git:1
4
+    depth: 50
5
+    tags: true
6
+
7
+pipeline:
8
+  restore-cache:
9
+      image: drillster/drone-volume-cache
10
+      restore: true
11
+      mount:
12
+          - .cache
13
+      volumes:
14
+          - /tmp/cache:/cache
15
+
16
+  build:
17
+    image: python:3-alpine
18
+    commands:
19
+      - pip install --upgrade pip setuptools
20
+      - pip install --cache-dir=/cache flake8
21
+      - pip install --cache-dir=/cache black
22
+      - pip install --cache-dir=/cache -r requirements.txt
23
+      - python setup.py install
24
+      - black --check .
25
+      - flake8 .
26
+      - cp tests/config_test.py config.py
27
+      - python setup.py test
28
+
29
+  migrations:
30
+    image: python:3-alpine
31
+    commands:
32
+      - pip install --upgrade pip setuptools
33
+      - pip install --cache-dir=/cache flake8
34
+      - pip install --cache-dir=/cache black
35
+      - pip install --cache-dir=/cache -r requirements.txt
36
+      - python setup.py install
37
+      - psql -U postgres -h database -w -c 'CREATE DATABASE ahrl'
38
+      - cp config.py.sample config.py
39
+      - flask db upgrade
40
+
41
+  rebuild-cache:
42
+      image: drillster/drone-volume-cache
43
+      rebuild: true
44
+      mount:
45
+          - .cache
46
+      volumes:
47
+          - /tmp/cache:/cache
48
+
49
+  notify:
50
+    image: plugins/slack
51
+    channel: gitea
52
+    secrets:
53
+      - SLACK_WEBHOOK
54
+    when:
55
+      event: [ push, tag, pull_request ]
56
+      status: [ changed, failure, success ]
57
+
58
+services:
59
+  database:
60
+    image: postgres
61
+    environment:
62
+      - POSTGRES_USER=postgres
63
+      - POSTGRES_DB=ahrl_test
64
+

+ 3
- 0
.gitignore View File

@@ -8,3 +8,6 @@ tmp/cty.xml
8 8
 .ropeproject/
9 9
 venv
10 10
 *.log
11
+.coverage
12
+ahrl.egg-info
13
+.eggs

+ 3
- 0
.isort.cfg View File

@@ -0,0 +1,3 @@
1
+[settings]
2
+line_length=120
3
+force_single_line=false

+ 4
- 0
babel.cfg View File

@@ -0,0 +1,4 @@
1
+[python: **.py]
2
+[jinja2: **/templates/**.jinja2]
3
+[jinja2: **/templates/**.html]
4
+extensions=jinja2.ext.autoescape,jinja2.ext.with_

+ 12
- 0
pyproject.toml View File

@@ -0,0 +1,12 @@
1
+[tool.black]
2
+line-length = 120
3
+py36 = true
4
+exclude = '''
5
+/(
6
+    \.git
7
+  | \.eggs
8
+  | \.idea
9
+  | \__pycache__
10
+)/
11
+'''
12
+skip-numeric-underscore-normalization = true

+ 10
- 0
setup.cfg View File

@@ -0,0 +1,10 @@
1
+[aliases]
2
+test=pytest
3
+
4
+[tool:pytest]
5
+addopts = --verbose --cov=.
6
+python_files = tests/*.py
7
+
8
+[flake8]
9
+max-line-length = 120
10
+ignore = E501

+ 39
- 0
setup.py View File

@@ -0,0 +1,39 @@
1
+from setuptools import setup
2
+
3
+setup(
4
+    name="ahrl",
5
+    version="0.0.1",
6
+    license="MIT",
7
+    python_requires=">=3.6",
8
+    long_description=open("README.md").read(),
9
+    url="http://github.com/rhaamo/ahrl",
10
+    author="Dashie",
11
+    author_email="dashie@sigpipe.me",
12
+    install_requires=[
13
+        "Flask",
14
+        "SQLAlchemy",
15
+        "WTForms",
16
+        "WTForms-Alchemy",
17
+        "SQLAlchemy-Searchable",
18
+        "SQLAlchemy-Utils",
19
+        "Flask-Bootstrap",
20
+        "Flask-DebugToolbar",
21
+        "Flask-Login",
22
+        "Flask-Mail",
23
+        "Flask-Migrate",
24
+        "Flask-Principal",
25
+        "Flask-Security",
26
+        "Flask-SQLAlchemy",
27
+        "Flask-Uploads",
28
+        "Flask-WTF",
29
+        "bcrypt",
30
+        "psycopg2-binary",
31
+        "unidecode",
32
+        "Flask_Babelex",
33
+        "texttable",
34
+        "python-slugify",
35
+        "flask-accept",
36
+    ],
37
+    setup_requires=["pytest-runner"],
38
+    tests_require=["pytest", "pytest-cov", "jsonschema"],
39
+)

Loading…
Cancel
Save