Skip to content

Commit

Permalink
Include release pipeline in tox (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Aug 8, 2024
1 parent 6866b3b commit 8b56a0b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 40 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/release.yml

This file was deleted.

40 changes: 39 additions & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: ["main"]
pull_request:
branches: ["main"]
release:
types: [published]
# Run the tox tests every 8 hours.
# This will help to identify faster if
# there is a CI failure related to a
Expand Down Expand Up @@ -38,7 +40,7 @@ jobs:
default_python: "3.10"
other_names: |
lint
packaging
pkg
py38,py38-devel
py39,py39-devel
py310,py310-devel
Expand Down Expand Up @@ -183,3 +185,39 @@ jobs:
uses: actions/upload-artifact/merge@v4
with:
delete-merged: true
pypi:
name: Publish to PyPI registry
needs: check
if: github.event_name == 'release' && github.event.action == 'published'
environment: release # approval
runs-on: ubuntu-24.04
permissions:
id-token: write

env:
FORCE_COLOR: 1
PY_COLORS: 1
TOXENV: pkg

steps:
- name: Switch to using Python 3.10 by default
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install tox
run: python3 -m pip install --user "tox>=4.0.0"

- name: Check out src from Git
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed by setuptools-scm
submodules: true

- name: Build dists
run: python3 -m tox

- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ maintainers = [
]
license = {text = "MIT"}
classifiers = [
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Framework :: tox",
"License :: OSI Approved :: MIT License",
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ minversion = 4.0.2
ignore_path = tests
envlist =
lint
packaging
pkg
py
py-devel

Expand Down Expand Up @@ -42,7 +42,7 @@ deps =
commands =
python -m pre_commit run {posargs:--all}

[testenv:packaging]
[testenv:pkg]
description =
Test packaging
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
Expand Down

0 comments on commit 8b56a0b

Please sign in to comment.