ci: Update and fix workflow file #19
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: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
jobs: | |
build_and_test: | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ matrix.allow-failure }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.7", "3.8", "3.9", "3.10"] | |
extras: [""] | |
allow-failure: [false] | |
include: | |
- python-version: "2.7" | |
os: ubuntu-20.04 | |
extras: "" | |
allow-failure: true | |
- python-version: "3.5" | |
os: ubuntu-20.04 | |
extras: "" | |
allow-failure: true | |
- python-version: "3.6" | |
os: ubuntu-20.04 | |
extras: "" | |
allow-failure: true | |
- python-version: "3.8" | |
os: ubuntu-latest | |
extras: "pymc3" | |
allow-failure: true | |
- python-version: "3.8" | |
os: ubuntu-latest | |
extras: "pymc4" | |
allow-failure: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os}}-pip-${{ matrix.python-version }} | |
path: ~/.cache/pip | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install "numpy>=1.13.0,!=1.15.*" | |
pip install pybind11 | |
pip install -U pytest "pytest-cov<2.9" codecov coveralls | |
pip install scrutinizer-ocular | |
- name: Install package | |
run: | | |
pip install -e ".[tests]" | |
- name: Install extras | |
if: matrix.extras != '' | |
run: | | |
pip install -e ".[${{ matrix.extras }}]" | |
- run: pip list | |
- name: Test | |
run: | | |
py.test -v --cov regressproxy | |
- name: Convert coverage | |
run: python -m coverage xml | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v3 | |
- name: Upload to Coveralls | |
if: matrix.python-version != '2.7' | |
run: | | |
python -m coveralls --service=github | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
COVERALLS_PARALLEL: true | |
COVERALLS_FLAG_NAME: py${{ matrix.python-version }} | |
coverage: | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Finish coverage collection | |
run: | | |
python -m pip install -U pip | |
python -m pip install -U coveralls | |
python -m coveralls --finish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
name: Deploy to PyPi | |
needs: build_and_test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: python -m pip install --upgrade pip | |
- run: python -m pip install build twine check-wheel-contents | |
- name: Build package | |
run: python -m build --sdist --wheel . | |
- run: ls -alF dist/ | |
- run: check-wheel-contents dist/*.whl | |
- name: Check long_description | |
run: python -m twine check dist/* | |
- name: Publish package to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
- name: Publish tagged release to PyPI | |
if: startsWith(github.ref, 'refs/tags') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip_existing: true |