1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
# 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-22.04
timeout-minutes: 10 # stop runaway job after 10 minutes
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14', 'pypy3.10', 'pypy3.11']
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
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.13 only)
if: matrix.python-version == '3.13'
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' && matrix.python-version != 'pypy3.11'
run: |
python -m pip install mypy
mypy --strict precis_i18n
|