Skip to content

Commit

Permalink
chore: Add Woodpecker CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed Sep 10, 2024
1 parent 94274e7 commit 1a5ed71
Show file tree
Hide file tree
Showing 3 changed files with 230 additions and 15 deletions.
160 changes: 160 additions & 0 deletions .woodpecker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
when:
- event: pull_request
- event: [push, tag, manual]
branch: main

steps:
test:
image: python:${PYTHON_VERSION}-bookworm
commands:
- pip install tox
- tox -e "prj${PRJ}-py${PYTHON_VERSION/./}-${DJANGO_VERSION}"
when:
- matrix:
STEP: test

run-py:
image: python:3.12-bookworm
commands:
- make "ci-install-${STEP/run-py-/}"
- make "${STEP/run-py-/}"
when:
- matrix:
STEP: run-py-*

standardjs:
image: node:22-bookworm
commands:
- make ci-install-standardjs
- make standardjs
when:
- matrix:
STEP: run-js-standardjs

matrix:
# NOTE: Woodpecker does not seem to have support for matrix exclusion, at
# least, I couldn't get it to work. Opted for handcoding the whole matrix :(
include:
######################################################################
# Linters

- STEP: run-py-black
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: run-py-mo
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: run-py-djlint
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: run-py-docs
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: run-py-flake8
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: run-py-isort
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: run-py-mypy
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: run-js-standardjs
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12

######################################################################
# Regular project

# Pytho 3.8/3.9 require Django <5
- STEP: test
PRJ: regular
DJANGO_VERSION: django42
PYTHON_VERSION: 3.8
- STEP: test
PRJ: regular
DJANGO_VERSION: django42
PYTHON_VERSION: 3.9

# Python 3.10+ work with django5+
- STEP: test
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.10
- STEP: test
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.11
- STEP: test
PRJ: regular
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: test
PRJ: regular
DJANGO_VERSION: django51
PYTHON_VERSION: 3.10
- STEP: test
PRJ: regular
DJANGO_VERSION: django51
PYTHON_VERSION: 3.11
- STEP: test
PRJ: regular
DJANGO_VERSION: django51
PYTHON_VERSION: 3.12
# Only test main on latest Python
- STEP: test
PRJ: regular
DJANGO_VERSION: djangomain
PYTHON_VERSION: 3.12

######################################################################
# Headless project

# Pytho 3.8/3.9 require Django <5
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django42
PYTHON_VERSION: 3.8
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django42
PYTHON_VERSION: 3.9

# Python 3.10+ work with django5+
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django50
PYTHON_VERSION: 3.10
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django50
PYTHON_VERSION: 3.11
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django50
PYTHON_VERSION: 3.12
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django51
PYTHON_VERSION: 3.10
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django51
PYTHON_VERSION: 3.11
- STEP: test
PRJ: headless_only
DJANGO_VERSION: django51
PYTHON_VERSION: 3.12
# Only test main on latest Python
- STEP: test
PRJ: headless_only
DJANGO_VERSION: djangomain
PYTHON_VERSION: 3.12
84 changes: 69 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ PYTHON = python
.PHONY: usage
usage:
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@echo ' black Auto format Python code'
@echo ' isort Fix isort issues'
@echo ' po (Re)generate .po files'
@echo ' mo Compile .po into .mo'
@echo ' qa Perform QA checks'
@echo ' test Execute test suite'

.PHONY: po
po:
Expand All @@ -22,27 +14,89 @@ mo:

.PHONY: isort
isort:
isort .
isort --check-only --diff .

.PHONY: black
black:
black allauth/ setup.py
black --check .

.PHONY: test
test:
pytest allauth/

.PHONY: qa
qa: validate-api-spec mypy
flake8 allauth
isort --check-only --diff .
black --check .

.PHONY: djlint
djlint:
djlint --check allauth examples

.PHONY: flake8
flake8:
flake8 allauth

.PHONY: qa
qa: validate-api-spec mypy djlint black isort flake8

.PHONY: mypy
mypy:
mypy allauth/

.PHONY: validate-api-spec
validate-api-spec:
swagger-cli validate docs/headless/openapi-specification/openapi.yaml

.PHONY: ci
ci:
woodpecker-cli exec .woodpecker.yaml


.PHONY: standardjs
standardjs:
find ./allauth -name '*.js' | xargs ./node_modules/.bin/standard --ignore allauth/mfa/static/mfa/js/webauthn-json.js


.PHONY: docs
docs:
$(MAKE) -C docs html


.PHONY: ci-install-black
ci-install-black:
pip install black==24.4.0

.PHONY: ci-install-mo
ci-install-mo:
apt-get update
apt-get install -y --no-install-recommends gettext
pip install .[mfa,socialaccount,openid,saml]

.PHONY: ci-install-standardjs
ci-install-standardjs:
npm install standard --no-lockfile --no-progress --non-interactive --silent

.PHONY: ci-install-djlint
ci-install-djlint:
pip install djlint==1.34.1

.PHONY: ci-install-docs
ci-install-docs:
pip install Django Sphinx sphinx_rtd_theme

.PHONY: ci-install-flake8
ci-install-flake8:
pip install flake8==7.1.1

.PHONY: ci-install-isort
ci-install-isort:
pip install isort==5.13.2

.PHONY: ci-install-mypy
ci-install-mypy:
pip install .[mfa,socialaccount,openid,saml]
pip install \
'django-stubs==5.0.2' \
'mypy==1.10.0' \
'pytest>=7.4' \
'pytest-asyncio == 0.23.8' \
'pytest-django>=4.5.2' \
'types-requests==2.32.0.20240602' \
'python3-saml>=1.15.0,<2.0.0'
1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ stdenv.mkDerivation {
playwright-test

swagger-cli
woodpecker-cli
];
shellHook = ''
export PATH="$PWD/node_modules/.bin/:$PATH"
Expand Down

0 comments on commit 1a5ed71

Please sign in to comment.