Skip to content

Run tests on PR events #31

Run tests on PR events

Run tests on PR events #31

Workflow file for this run

name: Python package
on:
push:
pull_request:
types: [opened, synchronize, reopened]
jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache dependencies
uses: actions/cache@v3
id: cache-dependencies
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'test-requirements.txt') }}
- name: Install dependencies
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r test-requirements.txt
- name: Test with pytest
run: |
pytest -rP tests/ --cov=dparse/ --cov-report=xml --cov-report=html
deploy:
needs: test
runs-on: ubuntu-20.04
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}