change from deprecated pytest method of checking no warnings raised (… #171
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: Run tests and build package | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
jobs: | |
linting: | |
name: Run linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.7" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
pip install -r requirements.txt | |
pip install -e . | |
- name: Linting with flake8 | |
run: | | |
flake8 . --count --show-source --exclude=*.ipynb_checkpoints | |
tests: | |
name: Run tests | |
needs: linting | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
max-parallel: 5 | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install -e . | |
- name: Run tests with pytest | |
run: | | |
pytest --cov=impedance . | |
- name: Upload coverage to coveralls | |
if: matrix.python-version == 3.10 && github.repository == 'ECSHackWeek/impedance.py' | |
run: coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-and-push: | |
name: Build and publish package to PyPI | |
needs: [linting, tests] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Build a binary wheel and a source tarball | |
run: | | |
python3 -m pip install wheel | |
python3 setup.py sdist bdist_wheel | |
- name: Publish distribution to PyPI (if tagged) | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |