Skip to content

Commit

Permalink
👷 update GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Coperh committed Oct 30, 2024
1 parent 10fad63 commit d7b3b6d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 26 deletions.
65 changes: 39 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,54 @@ on:
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.10', '3.11', '3.12']
django: ['4.2']

name: Test the creation of a Django project from the template
name: Run the test suite (Python ${{ matrix.python }}, Django ${{ matrix.django }})

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: ${{ matrix.python }}

- name: Install Django 4.2
run: pip install django~=4.2.0
- name: Install dependencies
run: pip install tox tox-gh-actions

- name: Run the startproject command
run: |
mkdir tmp
django-admin startproject \
--template . \
--extension=py-tpl,rst,gitignore,in,ini,cfg,toml,yml,yaml \
--name LICENSE \
-x tmp \
-x .github \
defaultapp tmp/
- name: Run basic checks (following README instructions)
run: |
pip install -e .[tests]
django-admin check
pytest
- name: Run tests
run: tox
env:
PYTHONPATH: .
DJANGO_SETTINGS_MODULE: testapp.settings
working-directory: tmp
PYTHON_VERSION: ${{ matrix.python }}
DJANGO: ${{ matrix.django }}

- name: Publish coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

publish:
name: Publish package to PyPI
runs-on: ubuntu-latest
needs: tests
environment: release
permissions:
id-token: write

if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')

- name: Run dummy package build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Build sdist and wheel
run: |
pip install build
pip install build --upgrade
python -m build
working-directory: tmp
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

33 changes: 33 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Code quality checks

# Run this workflow every time a new commit pushed to your repository
on:
push:
branches:
- main
tags:
- '*'
paths:
- '**.py'
pull_request:
paths:
- '**.py'
workflow_dispatch:

jobs:
linting:
name: Code-quality checks
runs-on: ubuntu-latest
strategy:
matrix:
toxenv: [isort, black, flake8, docs]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: pip install tox
- run: tox
env:
TOXENV: ${{ matrix.toxenv }}

0 comments on commit d7b3b6d

Please sign in to comment.