Ensure cli extra is installed for docs generation #1140
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
| name: CI | |
| on: [push, pull_request] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install uv and Python | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Setup uv venv | |
| run: | | |
| uv sync --locked --all-extras --group ci | |
| - name: Lint with ruff | |
| run: | | |
| uv run ruff check --select I flask_limiter tests examples | |
| uv run ruff format --check flask_limiter tests examples | |
| uv run ruff check flask_limiter tests examples | |
| - name: Type checking | |
| run: | | |
| uv run mypy flask_limiter | |
| test: | |
| runs-on: ubuntu-latest | |
| name: Test (Python ${{ matrix.python-version }}, Flask ${{matrix.flask-version}}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| flask-version: ["flask>=2.3,<2.4", "flask>=3.0,<3.1", "flask>=3.1,<3.2"] | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install uv and Python | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Setup uv venv | |
| run: | | |
| uv sync --locked --all-extras --group ci | |
| - name: Install Flask ${{ matrix.flask-version }} | |
| run: | | |
| uv pip uninstall flask werkzeug | |
| uv pip install "${{ matrix.flask-version }}" | |
| - name: Test | |
| run: | | |
| uv run pytest --cov-report=xml | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Check Coverage | |
| run: | | |
| uv run coverage report --fail-under=100 || (echo 'Insufficient coverage' && $(exit 1)) | |
| build_wheels: | |
| needs: [lint] | |
| name: Build wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv and Python | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| python-version: 3.13 | |
| - name: Setup uv venv | |
| run: | | |
| uv sync --locked --all-extras --group ci | |
| - name: Build wheels | |
| run: | | |
| uv build --wheel | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels | |
| path: ./dist/*.whl | |
| build_sdist: | |
| needs: [lint] | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install uv and Python | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| python-version: 3.13 | |
| - name: Setup uv venv | |
| run: | | |
| uv sync --locked --all-extras --group ci | |
| - name: Build sdist | |
| run: | | |
| uv build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: src_dist | |
| path: dist/*.tar.gz | |
| upload_pypi: | |
| needs: [test, build_wheels, build_sdist] | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: wheels | |
| path: dist | |
| - uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: src_dist | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| skip-existing: true | |
| upload_pypi_release: | |
| needs: [test, build_wheels, build_sdist] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: wheels | |
| path: dist | |
| - uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: src_dist | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| github_release: | |
| needs: [upload_pypi_release] | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: wheels | |
| path: dist | |
| - name: Download src dist | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| name: src_dist | |
| path: dist | |
| - name: Generate release notes | |
| run: | | |
| ./scripts/github_release_notes.sh > release_notes.md | |
| - name: Create Release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| artifacts: "dist/*" | |
| bodyFile: release_notes.md | |
| token: ${{ secrets.GITHUB_TOKEN }} |