From e1227adaad892f56fee99f326c04b6bd2fd3afb5 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 15 Nov 2022 08:59:53 -0300 Subject: [PATCH] Split CI workflows into 'test' and 'deploy' 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` --- .github/workflows/deploy.yml | 36 ++++++++++++++++++++++++ .github/workflows/{main.yml => test.yml} | 33 ++-------------------- README.rst | 2 +- 3 files changed, 39 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/deploy.yml rename .github/workflows/{main.yml => test.yml} (78%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..2ad680ce --- /dev/null +++ b/.github/workflows/deploy.yml @@ -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 }} diff --git a/.github/workflows/main.yml b/.github/workflows/test.yml similarity index 78% rename from .github/workflows/main.yml rename to .github/workflows/test.yml index 5eef8b89..7591b1fa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/test.yml @@ -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: @@ -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 }} diff --git a/README.rst b/README.rst index 3496617e..7383ec7b 100644 --- a/README.rst +++ b/README.rst @@ -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