Skip to content

Commit

Permalink
Add CI, pre-commit and bump depedencies (#93)
Browse files Browse the repository at this point in the history
Python 3.6+
Django 2.2+
  • Loading branch information
Mojken authored Mar 31, 2022
1 parent 133a24a commit 4672f31
Show file tree
Hide file tree
Showing 90 changed files with 1,253 additions and 1,162 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
.gitignore
.next/
.stuff/
.travis.yml
.venv/
Dockerfile
dist/
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: pre-commit/[email protected]

tests:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
max-parallel: 5
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade packaging tools
run: python -m pip install --upgrade pip setuptools virtualenv
- name: Install dependencies
run: python -m pip install --upgrade tox
- name: Run tox targets for ${{ matrix.python-version }}
run: |
ENV_PREFIX=$(tr -C -d "0-9" <<< "${{ matrix.python-version }}")
TOXENV=$(tox --listenvs | grep "^py$ENV_PREFIX" | tr '\n' ',') python -m tox
- uses: actions/upload-artifact@master
with:
name: coverage-files
path: ./.coverage.*

coverage:
name: Reporting Coverage
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize')
needs: [tests]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/download-artifact@v3
with:
name: coverage-files
path: .
- name: Combine coverage reports
run: |
python -m pip install coverage
make coverage-lcov
- name: Upload coverage report
uses: coverallsapp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./coverage.info"
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*.egg
*.egg-info
*.eggs/
.coverage
.coverage*
.idea
.DS_Store
.tox
Expand All @@ -22,4 +22,4 @@ example/db.sqlite3
*~
\#*\#
.#*.*
*_flymake*
*_flymake*
81 changes: 81 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
default_language_version:
python: python3.9
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: debug-statements
- id: detect-private-key
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args:
- --py36-plus
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args:
- --in-place
- --remove-all-unused-imports
- --ignore-init-module-imports
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.1
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-comprehensions
- flake8-tidy-imports
- repo: https://github.com/sirosen/check-jsonschema
rev: 0.11.0
hooks:
- id: check-github-workflows
# - repo: https://github.com/mgedmin/check-manifest
# rev: "0.47"
# hooks:
# - id: check-manifest
# # See https://github.com/mgedmin/check-manifest/issues/141
# args: ["--no-build-isolation"]
# Unsure how to solve this failing

exclude: |
(?x)(
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.pytest_cache
| \.nox
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
| ^(
example
| scripts
| tests/project/files
)/
)
93 changes: 0 additions & 93 deletions .travis.yml

This file was deleted.

7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ coverage:
coverage combine || true
coverage report

.PHONY: coverage-lcov
coverage-lcov:
coverage combine || true
coverage lcov -o coverage.info

.PHONY: lint
lint:
flake8 djedi
pre-commit run --all-files

.PHONY: install
install:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Django content management as it should be.

[![Build Status](https://travis-ci.org/5monkeys/djedi-cms.svg?branch=master)](https://travis-ci.org/5monkeys/djedi-cms)
[![Build Status](https://github.com/5monkeys/djedi-cms/workflows/CI/badge.svg)](https://github.com/5monkeys/djedi-cms/actions)
[![Coverage Status](https://coveralls.io/repos/5monkeys/djedi-cms/badge.svg?branch=master&service=github)](https://coveralls.io/github/5monkeys/djedi-cms?branch=master)
[![Version](https://img.shields.io/pypi/v/djedi-cms.svg)](https://pypi.python.org/pypi/djedi-cms/)
[![Python Versions](https://img.shields.io/pypi/pyversions/djedi-cms.svg)](https://pypi.python.org/pypi/djedi-cms/)
Expand All @@ -28,11 +28,11 @@ Example settings for Django 2.0:

INSTALLED_APPS = (
# ...
'djedi',
"djedi",
)

MIDDLEWARE = [
'djedi.middleware.translation.DjediTranslationMiddleware',
"djedi.middleware.translation.DjediTranslationMiddleware",
# ...
]
```
Expand All @@ -49,7 +49,7 @@ $ django-admin.py migrate djedi
# urls.py

urlpatterns = [
path('admin/', admin.site.urls),
path("admin/", admin.site.urls),
]
```

Expand Down
1 change: 0 additions & 1 deletion djedi-react/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
.gitignore
.next/
.stuff/
.travis.yml
Dockerfile
dist/
docker-compose.yml
Expand Down
2 changes: 1 addition & 1 deletion djedi-react/.npm-upgrade.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"reason": "Not compatible with newer versions"
}
}
}
}
4 changes: 2 additions & 2 deletions djedi-react/test/Node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ test("it handles nodes with null value in response", async () => {
<span
data-i18n="en-us@test"
>
</span>
`);
});
Expand Down Expand Up @@ -773,7 +773,7 @@ Network error",
<span
data-i18n="en-us@5"
>
</span>
</article>
</div>
Expand Down
Loading

0 comments on commit 4672f31

Please sign in to comment.