Skip to content

Commit

Permalink
Merge pull request #69 from DemocracyClub/prepare-for-pypi
Browse files Browse the repository at this point in the history
Prepare for pypi
  • Loading branch information
VirginiaDooley authored Apr 8, 2024
2 parents ff948ea + 0f1b356 commit 4bec864
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 0 deletions.
48 changes: 48 additions & 0 deletions dc_utils/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Python Package

on:
release:
types: [created]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: '**/pyproject.toml'
- name: Install dependencies
run: |
pip install -e '.[test]'
- name: Run tests
run: |
pytest
deploy:
runs-on: ubuntu-latest
needs: [test]
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
cache-dependency-path: '**/pyproject.toml'
- name: Install dependencies
run: |
pip install setuptools wheel build
- name: Build
run: |
python -m build
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
29 changes: 29 additions & 0 deletions dc_utils/.github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test

on:
push:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
if: hashFiles('pyproject.toml')
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: '**/pyproject.toml'
- name: Install dependencies
if: hashFiles('pyproject.toml')
run: |
pip install -e '.[test]'
- name: Run tests
if: hashFiles('pyproject.toml')
run: |
pytest
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
[project]
name = "dc_django_utils"
version = "2.6.0"
description = "This is a package to provide some common utilities for Django projects at Democracy Club."
readme = "README.md"
authors = [{name = "Sym Roe"}, {name = "Virginia Dooley"}]

[project.urls]
Homepage = "https://github.com/DemocracyClub/dc_django_utils"
Changelog = "https://github.com/DemocracyClub/dc_django_utils/releases"
Issues = "https://github.com/DemocracyClub/dc_django_utils/issues"

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 80

[project.optional-dependencies]
test = ["pytest"]

0 comments on commit 4bec864

Please sign in to comment.