Skip to content

Add configuration file for RTFD #456

Add configuration file for RTFD

Add configuration file for RTFD #456

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout working copy
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: ruff check
uses: chartboost/ruff-action@v1
- name: ruff format
if: always()
uses: chartboost/ruff-action@v1
with:
args: format --diff
- name: Set up Python
id: setup_python
if: always()
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install mypy
id: install_mypy
if: ${{ always() && steps.setup_python.conclusion == 'success' }}
run: |
python -mpip install --upgrade pip
python -mpip install mypy types-PyYaml ./ua-parser-builtins
- name: mypy
if: ${{ always() && steps.install_mypy.conclusion == 'success' }}
run: mypy
# REPLACE BY: job which python -mbuild, and uploads the sdist and wheel to artifacts
# build is not binary so can just build the one using whatever python version
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout working copy
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependency
run: |
python -mpip install --upgrade pip
python -mpip install build
- name: Build sdist and wheel
run: |
python -mbuild
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*.tar.gz
retention-days: 1
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl
retention-days: 1
test:
runs-on: ubuntu-latest
needs: compile
strategy:
fail-fast: false
matrix:
source:
- wheel
- sdist
- source
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "pypy-3.10"
# - "pypy-3.11"
- "graalpy-24"
include:
- source: sdist
artifact: dist/*.tar.gz
- source: wheel
artifact: dist/*.whl
- opts: ""
- python-version: graalpy-24
opts: "--experimental-options --engine.CompileOnly='~tregex re'"
steps:
- name: Checkout working copy
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- run: python -mpip install --upgrade pip
- run: |
# if binary wheels are not available for the current
# package install libyaml-dev so we can install pyyaml
# from source
if ! pip download --only-binary :all: pyyaml > /dev/null 2>&1; then
sudo apt install libyaml-dev
fi
- run: python -mpip install pytest pyyaml
- run: python -mpip install ./ua-parser-builtins
# install rs accelerator if available, ignore if not
- run: python -mpip install ua-parser-rs || true
# re2 is basically impossible to install from source so don't
# bother, and suppress installation failure so the test does
# not fail (re2 tests will just be skipped for versions /
# implementations for which google does not provide a binary
# wheel)
- run: 'python -mpip install --only-binary :all: google-re2 || true'
- name: download ${{ matrix.source }} artifact
if: matrix.artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.source }}
path: dist/
- name: install package in environment
run: python -m pip install ${{ matrix.artifact || '.' }}
- name: run tests
run: python ${{ matrix.opts }} -m pytest -v -Werror -Wignore::ImportWarning --doctest-glob="*.rst" -ra