Move project configuration to pyproject.toml
#71
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 and upload Python package | |
on: | |
pull_request: | |
push: | |
branches: [master] | |
tags: | |
- 'v*' | |
- '!v*-dev' | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
- uses: pre-commit/[email protected] | |
test: | |
if: github.repository == 'zeek/zeek-client' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
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 pip | |
pip install -e '[.dev]' | |
- name: Run unit tests | |
run: pytest | |
upload: | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: github.repository == 'zeek/zeek-client' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check release version | |
# This fails e.g. if VERSION contains a dev commits suffix, | |
# since we don't want to push these to PyPI. | |
run: | | |
grep -E -x '[0-9]+\.[0-9]+\.[0-9]+' VERSION | |
- name: Build sdist | |
# This places the sdist in the dist folder, where the upload | |
# action in the next step knows to look for it. | |
run: | | |
make dist | |
- name: Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |