Skip to content

Commit

Permalink
refactor: CI (#752)
Browse files Browse the repository at this point in the history
* refactor: CI

Merge Linter & Unit Tests into single config

* ci: Drop testing for 3.6 and 3.7, add 3.10, 3.11 & 3.12

* chore: Add Pre Commit Config

* Bump linting tools
* Update config to match behaviour

* build: Skip import errors by flake8 in __init__

* build: Update envlist in tox.ini

* ci: Setup pre-commit runner, bump other actions

* chore: Remov 3.12 from CI until stable release

* build: Remove black dev-dependency, use pre-commit

* build: Update tox envlist to remove 3.12

* chore: Remove py312 as black target
  • Loading branch information
gavindsouza authored Sep 21, 2023
1 parent 30574f9 commit a1b0c82
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 32 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/black.yml

This file was deleted.

28 changes: 16 additions & 12 deletions .github/workflows/pythonpackage.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,36 @@
name: Unit Tests
name: CI

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch:

jobs:
test:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]

test:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
max-parallel: 4
max-parallel: 5
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install "coveralls<3.0.0"
run: python -m pip install -U pip -r requirements-dev.txt "coveralls<3.0.0"

- name: Run test suite
env:
Expand Down
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
exclude: '.git'
default_stages: [commit]
fail_fast: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
files: "pypika.*"
exclude: ".*json$|.*txt$|.*csv|.*md|.*svg"
- id: check-yaml
- id: no-commit-to-branch
args: ['--branch', 'master']
- id: check-merge-conflict
- id: check-ast
- id: check-json
- id: check-toml
- id: check-yaml
- id: debug-statements

- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[tool.black]
line-length = 120
skip-string-normalization = true
target-version = ['py36', 'py37', 'py38']
exclude = '''
target-version = ['py38', 'py39', 'py310', 'py311']
force-exclude = '''
(
/(
\.eggs # exclude a few common directories in the
Expand Down
3 changes: 0 additions & 3 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ tox==3.14.3
tox-venv==0.4.0
tox-gh-actions==0.3.0
coverage==5.1

# Formatting
black==21.5b1
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ universal = 1
[flake8]
exclude = docs, .git, __pycache__
max-line-length = 120
per-file-ignores = __init__.py:F401
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[tox]
envlist = py36,py37,py38,py39,pypy3
envlist = py38,py39,py310,py311,pypy3
[testenv]
deps = -r requirements-dev.txt
commands =
coverage run
coverage xml
[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311

0 comments on commit a1b0c82

Please sign in to comment.