fix: keep document listings when pruning link farms #1761
Workflow file for this run
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| # https://github.com/actions/python-versions/blob/main/versions-manifest.json | |
| python-version: ["3.10", "3.12", "3.14"] | |
| env: | |
| - MINIMAL: "true" | |
| - MINIMAL: "false" | |
| include: | |
| # custom OS / Python combinations | |
| - os: macos-latest | |
| python-version: "3.11" | |
| - os: windows-latest | |
| python-version: "3.11" | |
| - os: ubuntu-latest | |
| python-version: "3.13" | |
| env: | |
| MINIMAL: "false" | |
| steps: | |
| # package setup | |
| - uses: actions/checkout@v5 | |
| # Python and uv setup | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: pyproject.toml | |
| - name: Install dependencies | |
| run: uv pip install --system -e ".[dev]" | |
| - name: Lint and format check | |
| # bash stops at the first failing command on every runner. The default | |
| # shell on Windows is pwsh, which reports only the last command's status, | |
| # so a `ruff check` failure there was discarded by the `ruff format` pass. | |
| shell: bash | |
| run: | | |
| ruff check . | |
| ruff format --check --diff trafilatura tests | |
| # pycurl installation fix | |
| - name: Install packages required by pycurl | |
| if: ${{ matrix.env.MINIMAL == 'false' }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install libcurl4-gnutls-dev libgnutls28-dev | |
| # alternatively: sudo apt-get install libcurl4-openssl-dev libssl-dev | |
| - name: Install full dependencies | |
| if: ${{ matrix.env.MINIMAL == 'false' }} | |
| run: uv pip install --system -e ".[all]" | |
| - name: Type checking | |
| if: ${{ matrix.env.MINIMAL == 'false' && matrix.python-version == '3.13' }} | |
| run: | | |
| mypy -p trafilatura | |
| - name: Test with pytest | |
| run: | | |
| python -m pytest --cov=./ --cov-report=xml | |
| - name: Test docs | |
| # version matches .readthedocs.yaml | |
| if: ${{ matrix.env.MINIMAL == 'false' && matrix.python-version == '3.13' }} | |
| run: | | |
| uv pip install --system -e ".[docs]" | |
| python -m pytest docs/docs_tests.py | |
| # coverage | |
| - name: Upload coverage to Codecov | |
| if: ${{ matrix.env.MINIMAL == 'false' && matrix.python-version == '3.13' }} | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| fail_ci_if_error: true | |
| files: ./coverage.xml | |
| verbose: true |