Skip to content

Commit

Permalink
Swap CircleCI for GH Actions for CI: test and relase publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejalim committed Jan 24, 2024
1 parent b72f712 commit 874e50b
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 94 deletions.
87 changes: 0 additions & 87 deletions .circleci/config.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "CI" # Note that this name appears in the README's badge
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
release:
types: [published]
jobs:
run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- 'pypy-3.8'
- 'pypy-3.9'
- 'pypy-3.10'

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: tox

release:
name: Release django-csp
if: github.event_name == 'release' && github.event.action == 'published'
needs:
- run-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies for package building only
run: pip install build
- name: Build package for upload to PyPI
run: python -m build .
- name: Upload the distribution to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.. image:: https://badge.fury.io/py/django-csp.svg
:target: https://pypi.python.org/pypi/django_csp

.. image:: https://circleci.com/gh/mozilla/django-csp/tree/main.svg?style=shield
:target: https://circleci.com/gh/mozilla/django-csp/?branch=main
.. image:: https://github.com/mozilla/django-csp/actions/workflows/run-tests.yaml/badge.svg
:target: https://github.com/mozilla/django-csp/actions/workflows/run-tests.yaml

.. image:: https://coveralls.io/repos/github/mozilla/django-csp/badge.svg?branch=main
:target: https://coveralls.io/github/mozilla/django-csp?branch=main
Expand Down
38 changes: 33 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,28 +1,56 @@
[tox]
envlist =
{3.10,3.11,3.12,pypy3}-main
{3.10,3.11,3.12pypy3}-5.0.x
{3.8,3.9,3.10,3.11,3.12,pypy3}-4.2.x
{3.8,3.9,3.10,pypy3}-3.2.x
{3.10,3.11,3.12,pypy310}-main
{3.10,3.11,3.12,pypy310}-5.0.x
{3.8,3.9,3.10,3.11,3.12,pypy38,pypy39,pypy310}-4.2.x
{3.8,3.9,3.10,pypy38,pypy39,pypy310}-3.2.x


# Don't run coverage when testing with pypy:
# see https://github.com/nedbat/coveragepy/issues/1382
[testenv:pypy310-main,pypy310-5.0.x,{pypy38,pypy39,pypy310}-4.2.x,{pypy38,pypy39,pypy310}-3.2.x}]
commands =
pip install --upgrade pip
pip install -e .[tests]
pytest {toxinidir}/csp


[testenv]
setenv =
PYTHONPATH={toxinidir}
PYTHONDONTWRITEBYTECODE=1

commands =
pip install --upgrade pip
pip install -e .[tests]
pytest --cov={toxinidir}/csp {toxinidir}/csp

basepython =
3.8: python3.8
3.9: python3.9
3.10: python3.10
3.11: python3.11
3.12: python3.12
pypy3: pypy3
deps=

deps =
pytest
3.2.x: Django>=3.2,<3.3
4.2.x: Django>=4.2,<4.3
5.0.x: Django>=5.0.1,<5.1
main: https://github.com/django/django/archive/main.tar.gz


[gh-actions]
# Running tox in GHA without redefining it all in a GHA matrix:
# https://github.com/ymyzk/tox-gh-actions
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
pypy-3.8: pypy38
pypy-3.9: pypy39
pypy-3.10: pypy310

0 comments on commit 874e50b

Please sign in to comment.