Skip to content

Commit

Permalink
Merge pull request #199 from jdkandersson/refactor/switch-to-gha
Browse files Browse the repository at this point in the history
Add pytest
  • Loading branch information
jdkandersson authored Oct 10, 2020
2 parents 40ad8c9 + 9dde4a3 commit 7f1d11a
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 237 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Code quality checks

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 0 * * *"

jobs:
pytest:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-${{ matrix.os }}-${{ matrix.python-version }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev,test]
- name: Test with pytest
run: |
pytest
staticPython:
runs-on: ubuntu-latest
strategy:
matrix:
command:
- bandit -r open_alchemy -s B101,B303,B310

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: actions/cache@v1
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev,test]
- name: Run static code analyser
run: |
${{ matrix.command }}
staticNode:
runs-on: ubuntu-latest
strategy:
matrix:
command:
- npx cspell "open_alchemy/**/*.py" "open_alchemy/**/*.json" "open_alchemy/**/*.j2" "docs/**/*.rst" "docs/**/*/yml" "docs/**/*.yaml" "tests/**/*.py" "*.yaml" "*.json" "*.yml" "examples/**/*.py" "examples/**/*.yaml" "examples/**/*.yml"
- find examples -name "*spec.yml" ! -path "*/remote/*" | xargs -n 1 sh -c 'npx swagger-cli validate $0 || exit 255'

steps:
- uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm install cspell @apidevtools/swagger-cli
- name: Run static code analyser
run: |
${{ matrix.command }}
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: pre-commit/[email protected]
25 changes: 20 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ repos:
rev: 20.8b1
hooks:
- id: black
language_version: python3.7
language_version: python3.9
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.4.2
hooks:
Expand Down Expand Up @@ -31,8 +31,23 @@ repos:
hooks:
- exclude: "^docs.*.yaml$"
id: prettier
- repo: https://github.com/codespell-project/codespell
rev: v1.17.1
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: codespell
args: [-L connexion]
- id: check-added-large-files
- id: check-case-conflict
- id: check-docstring-first
exclude: ".*\/dist\/.*"
- id: check-merge-conflict
- id: debug-statements
- id: name-tests-test
args: ["--django"]
exclude: "\/helpers.py$"
- id: trailing-whitespace
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.9
hooks:
- id: forbid-crlf
- id: remove-crlf
- id: forbid-tabs
- id: remove-tabs
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=long-suffix,standarderror-builtin,indexing-exception,delslice-method,unichr-builtin,dict-view-method,parameter-unpacking,unicode-builtin,cmp-builtin,intern-builtin,round-builtin,backtick,nonzero-method,xrange-builtin,coerce-method,raw_input-builtin,old-division,filter-builtin-not-iterating,old-octal-literal,input-builtin,map-builtin-not-iterating,buffer-builtin,basestring-builtin,zip-builtin-not-iterating,using-cmp-argument,unpacking-in-except,old-raise-syntax,coerce-builtin,dict-iter-method,hex-method,range-builtin-not-iterating,useless-suppression,cmp-method,print-statement,reduce-builtin,file-builtin,long-builtin,getslice-method,execfile-builtin,no-absolute-import,metaclass-assignment,oct-method,reload-builtin,import-star-module-level,suppressed-message,apply-builtin,raising-string,next-method-called,setslice-method,old-ne-operator,arguments-differ,wildcard-import,locally-disabled
disable=duplicate-code,bad-continuation,import-error,unsubscriptable-object
disable=duplicate-code,bad-continuation,import-error,unsubscriptable-object,inherit-non-class


[REPORTS]
Expand Down
192 changes: 0 additions & 192 deletions azure-pipelines.yml

This file was deleted.

64 changes: 64 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"words": [
// Library
"tablename",
"uselist",
"sqlalchemy",
"backref",
"autoincrement",
"autoincremented",
"Autogenerated",
"mixins",
"connexion",
"docstrings",
"backrefs",
"openapi",
"ondelete",
// Python
"myapp",
"mymodel",
"DBAPI",
"paramstyle",
"venv",
"pathlib",
"setuptools",
"endfor",
"colargs",
"unsubscriptable",
"hdrs",
"xfail",
"pylint",
"pytest",
"sqlite",
"itertools",
"groupby",
"pyyaml",
"sdist",
"nosec",
"isdisjoint",
"isidentifier",
"rsplit",
"bdist",
"isclass",
"noqa",
"datetime",
// RST
"seealso",
"literalinclude",
"linenos",
"samp",
"toctree",
"maxdepth",
// People
"rgreinho",
"Andersson",
"jdkandersson"
],
"dictionaries": ["python"],
"ignorePaths": [
"tests/open_alchemy/models_file/test_types.py",
"examples/**/venv/**/*",
"package-lock.json",
"package.json"
]
}
Loading

0 comments on commit 7f1d11a

Please sign in to comment.