Linked PR to metricq-python branch #233
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test, build and publish the Python package | |
on: [push] | |
env: | |
PYTHON_VERSION: "3.10" | |
jobs: | |
test: | |
name: Run package tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- 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 pip | |
pip install tox tox-gh-actions | |
- name: Test with tox | |
run: tox | |
build: | |
name: Build distribution artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
- name: Build wheel | |
run: | | |
pip wheel --wheel-dir dist/ . | |
- name: Upload distribution artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: distribution-packages | |
path: dist/metricq_sink_nsca-*.whl | |
publish: | |
name: Publish package to PyPI | |
needs: | |
- test | |
- build | |
runs-on: ubuntu-latest | |
# If a new tag is pushed, publish a release to PyPI. | |
# This is rather fail-safe. If the tag name does not look like a version, | |
# either setuptools_scm will refuse to build the package, a test will fail | |
# or PyPI will reject the release. If it does look like a release, it's | |
# fine as long as no one accidentally pushes a tag named `x.y.z`. | |
# | |
# Pushing `x.y.z.devN` is fine though, it will be displayed as a | |
# pre-release verion on PyPI. | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Download distribution artifacts | |
uses: actions/download-artifact@v3.0.0 | |
with: | |
name: distribution-packages | |
path: dist/ | |
- name: Publish a Python distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |