CI #264
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: CI | |
on: | |
push: | |
branches: [ "*" ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
# Every Saturday at 4:30 AM UTC. | |
- cron: '30 4 * * 6' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.5', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14-dev', 'pypy3.10'] | |
include: | |
- pip-trusted-host: '' | |
# Relax security checks for Python 3.5 only. (https://github.com/actions/setup-python/issues/866) | |
- python-version: '3.5' | |
pip-trusted-host: 'pypi.python.org pypi.org files.pythonhosted.org' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
env: | |
PIP_TRUSTED_HOST: ${{ matrix.pip-trusted-host }} | |
PIP_DISABLE_PIP_VERSION_CHECK: 1 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip flake8 setuptools | |
if [ "${{ matrix.python-version }}" = "3.7" ]; then | |
python -m pip install unicodedata2==12.0.0 | |
elif [ "${{ matrix.python-version }}" = "3.8" ]; then | |
python -m pip install unicodedata2==14.0.0 | |
elif [ "${{ matrix.python-version }}" = "3.9" ]; then | |
python -m pip install unicodedata2==10.0.0 | |
elif [ "${{ matrix.python-version }}" = "3.10" ]; then | |
python -m pip install unicodedata2==15.0.0 | |
elif [ "${{ matrix.python-version }}" = "3.11" ]; then | |
python -m pip install unicodedata2==15.1.0 | |
elif [ "${{ matrix.python-version }}" = "3.12" ]; then | |
python -m pip install unicodedata2==15.1.0 | |
else | |
python -m pip install unicodedata2==15.0.0 | |
fi | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Run Tests | |
run: | | |
python -c "import unicodedata; print(unicodedata.unidata_version)" | |
python -m unittest discover -v | |
python -m doctest README.md || echo "doctest failed" | |
- name: Test source package | |
run: ./tools/test_python_package.sh | |
- name: Run Code Coverage (Python 3.11 only) | |
if: matrix.python-version == '3.11' | |
run: | | |
python -m pip install codecov | |
coverage run --source precis_i18n -m unittest test/test_precis.py test/test_codepointset.py test/test_codec.py test/test_factory.py | |
codecov | |
- name: Run mypy to check type stubs | |
if: matrix.python-version != 'pypy3.10' | |
run: | | |
python -m pip install mypy | |
mypy --strict precis_i18n |