Skip to content

check

check #1418

Workflow file for this run

name: check
on:
push:
pull_request:
schedule:
- cron: "0 8 * * *"
concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true
jobs:
pre_commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- uses: pre-commit/[email protected]
test:
name: test ${{ matrix.py }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- Ubuntu
- Windows
- MacOs
py:
- '3.10'
- 3.9
- 3.8
- 3.7
- 3.6
- 3.5
steps:
- name: setup python for tox
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install tox
run: python -m pip install tox
- name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
miniconda-version: "latest"
python-version: ${{ matrix.py }}
- uses: actions/checkout@v3
- name: pick environment to run
run: |
import subprocess; import json; import os
major, minor, impl = json.loads(subprocess.check_output(["python", "-c", "import json; import sys; import platform; print(json.dumps([sys.version_info[0], sys.version_info[1], platform.python_implementation()]));"], universal_newlines=True))
with open(os.environ['GITHUB_ENV'], 'a') as file_handler:
file_handler.write('TOXENV=' + ("py" if impl == "CPython" else "pypy") + ("{}{}".format(major, minor) if impl == "CPython" else "3") + "\n")
shell: python
- name: setup test suite
run: tox -vv --notest
- name: run test suite
run: tox --skip-pkg-install
env:
PYTEST_ADDOPTS: "-vv --durations=20"
CI_RUN: "yes"
DIFF_AGAINST: HEAD
- name: rename coverage report file
run: |
import os; os.rename('.tox/coverage.{}.xml'.format(os.environ['TOXENV']), '.tox/coverage.xml')
shell: python
- uses: codecov/codecov-action@v3
with:
file: ./.tox/coverage.xml
flags: tests
name: ${{ matrix.py }} - ${{ matrix.os }}
check:
name: check ${{ matrix.tox_env }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- Windows
- Ubuntu
tox_env:
- dev
- pkg_meta
exclude:
- { os: windows, tox_env: pkg_meta }
steps:
- uses: actions/checkout@v3
- name: setup Python '3.10'
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install tox
run: python -m pip install tox
- name: run check for ${{ matrix.tox_env }}
run: python -m tox -e ${{ matrix.tox_env }}
env:
UPGRADE_ADVISORY: "yes"
publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [check, test, pre_commit]
runs-on: ubuntu-latest
steps:
- name: setup python to build package
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install pep517
run: python -m pip install build
- uses: actions/checkout@v3
- name: build package
run: python -m build -s -w . -o dist
- name: publish to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
user: __token__
password: ${{ secrets.pypi_password }}