Skip to content

Commit

Permalink
Split CI workflows into 'test' and 'deploy'
Browse files Browse the repository at this point in the history
This makes them easier to maintain and follows how other pytest repositories have evolved.

Also made some changes to the deploy workflow:

* Using Python 3.10
* Using `build` package instead of calling `python setup.py`
  • Loading branch information
nicoddemus committed Nov 15, 2022
1 parent 450b851 commit e1227ad
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 32 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: deploy

on:
push:
tags:
- "*"

permissions: {}

jobs:
deploy:
if: github.repository == 'pytest-dev/pytest'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade build
- name: Build package
run: python -m build

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_token }}
33 changes: 2 additions & 31 deletions .github/workflows/main.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: main
name: test

on:
push:
branches:
- main
tags:
- "*"

pull_request:
branches:
- main

jobs:
build:
test:
runs-on: ${{ matrix.os }}

strategy:
Expand Down Expand Up @@ -113,30 +111,3 @@ jobs:
env:
CODECOV_NAME: ${{ matrix.name }}
run: bash scripts/upload-coverage.sh -F GHA,${{ runner.os }}

deploy:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pluggy'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade wheel setuptools setuptools_scm
- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.5.1
with:
user: __token__
password: ${{ secrets.pypi_token }}
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Running this directly gets us::
.. |versions| image:: https://img.shields.io/pypi/pyversions/pluggy.svg
:target: https://pypi.org/pypi/pluggy

.. |github-actions| image:: https://github.com/pytest-dev/pluggy/workflows/main/badge.svg
.. |github-actions| image:: https://github.com/pytest-dev/pluggy/workflows/test/badge.svg
:target: https://github.com/pytest-dev/pluggy/actions

.. |conda-forge| image:: https://img.shields.io/conda/vn/conda-forge/pluggy.svg
Expand Down

0 comments on commit e1227ad

Please sign in to comment.