Skip to content

Commit

Permalink
first cut at django-routines
Browse files Browse the repository at this point in the history
  • Loading branch information
bckohan committed Jun 4, 2024
1 parent 1845aee commit c3833fd
Show file tree
Hide file tree
Showing 28 changed files with 4,090 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
72 changes: 72 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: lint

on:
push:
pull_request:
workflow_dispatch:
inputs:
debug:
description: 'Set to on, to open ssh debug session.'
required: true
default: 'off'

jobs:

linting:
runs-on: ubuntu-latest
strategy:
matrix:
# run static analysis on bleeding and trailing edges
python-version: [ '3.8', '3.10', '3.12' ]
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.0' # April 2025
exclude:
- python-version: '3.8'
django-version: '4.2'
- python-version: '3.12'
django-version: '4.2'
- python-version: '3.12'
django-version: '3.2'
- python-version: '3.10'
django-version: '3.2'
- python-version: '3.8'
django-version: '5.0'
- python-version: '3.10'
django-version: '5.0'

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install -E rich
poetry run pip install colorama
poetry run pip install -U "django~=${{ matrix.django-version }}"
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- name: Run Static Analysis
run: |
source .venv/bin/activate
./check.sh --no-fix
python -m readme_renderer ./README.md -o /tmp/README.html
echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
125 changes: 125 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: test

on:
push:
pull_request:
workflow_dispatch:
inputs:
debug:
description: 'Set to on, to open ssh debug session.'
required: true
default: 'off'
schedule:
- cron: '0 13 * * *' # Runs at 6 am pacific every day

jobs:

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
django-version:
- '3.2' # LTS April 2024
- '4.2' # LTS April 2026
- '5.0' # April 2025
exclude:
- python-version: '3.8'
django-version: '5.0'
- python-version: '3.9'
django-version: '5.0'
- python-version: '3.11'
django-version: '3.2'
- python-version: '3.12'
django-version: '3.2'

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

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install Release Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install
poetry run pip install -U "Django~=${{ matrix.django-version }}"
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- name: Run Unit Tests
run: |
poetry run pytest
poetry run pip uninstall -y rich
poetry run pytest --cov-append
mv .coverage py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage
- name: Store coverage files
uses: actions/upload-artifact@v4
with:
name: coverage-py${{ matrix.python-version }}-dj${{ matrix.django-version }}
path: py${{ matrix.python-version }}-dj${{ matrix.django-version }}.coverage

coverage-combine:
needs: [test]
runs-on: ubuntu-latest

steps:
- name: Install Emacs
if: ${{ github.event.inputs.debug == 'on' }}
run: |
sudo apt install emacs
- name: Setup tmate session
if: ${{ github.event.inputs.debug == 'on' }}
uses: mxschmitt/action-tmate@v3
with:
detached: true
timeout-minutes: 60
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install Release Dependencies
run: |
poetry config virtualenvs.in-project true
poetry run pip install --upgrade pip
poetry install
- name: Get coverage files
uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true

- run: ls -la *.coverage
- run: poetry run coverage combine --keep *.coverage
- run: poetry run coverage report
- run: poetry run coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
verbose: true
31 changes: 31 additions & 0 deletions check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
set -e # Exit immediately if a command exits with a non-zero status.

if [ "$1" == "--no-fix" ]; then
poetry run ruff format --check
poetry run ruff check --select I
poetry run ruff check
else
poetry run ruff format
poetry run ruff check --fix --select I
poetry run ruff check --fix
fi

poetry run mypy django_routines
poetry run pyright
poetry check
poetry run pip check
cd ./doc
poetry run doc8 --ignore-path build --max-line-length 100 -q
# check for broken links in the docs ############
set +e

# do not run this in CI - too spurious
if [ "$1" != "--no-fix" ]; then
poetry run sphinx-build -b linkcheck -q -D linkcheck_timeout=5 ./source ./build > /dev/null 2>&1
if [ $? -ne 0 ]; then
cat ./build/output.txt | grep broken
exit 1
fi
fi
#################################################
cd ..
Loading

0 comments on commit c3833fd

Please sign in to comment.