Skip to content

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #76

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows #76

name: Test, build and publish
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
jobs:
test:
name: Run tests and upload results
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12.0-alpha - 3.12"]
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 hatch pip
pip install black mypy pytest pytest-cov ruff
- name: Lint with mypy and ruff
run: |
black --check .
mypy .
ruff --format=github .
- name: Test with pytest
run: |
pytest --doctest-modules --junitxml=junit/test-results.xml --cov=src/pip_inside --cov-report=xml --cov-report=html
- name: Upload pytest test results
uses: actions/upload-artifact@v3
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
build:
name: Build wheels and source distribution
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
- name: Install build dependencies
run: python -m pip install --upgrade hatch
- name: Build
run: hatch build
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: dist/*
if-no-files-found: error
publish:
name: Publish package
runs-on: ubuntu-latest
needs: build
steps:
- name: Debug github.ref
run: echo ${{ github.ref }}
- uses: actions/download-artifact@v4.1.7
with:
name: artifacts
path: dist
# - name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository-url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}