name: Test on: push: branches: - main pull_request: workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read jobs: test: runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] include: - python-version: "3.14" coverage: true steps: - uses: actions/checkout@v7 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} allow-prereleases: true cache: pip cache-dependency-path: pyproject.toml check-latest: true - name: Build extension for --load-extension test run: |- (cd tests && gcc ext.c -fPIC -shared -o ext.so) - name: Install dependencies run: | pip install . --group dev pip freeze - name: Install pytest-cov if: ${{ matrix.coverage }} run: pip install pytest-cov - name: Run tests run: | if [ "${{ matrix.coverage }}" = "true" ]; then COV="--cov=datasette --cov-config=.coveragerc" pytest -n auto -m "not serial" $COV --cov-report= pytest -m "serial" $COV --cov-append --cov-report xml:coverage.xml --cov-report term else pytest -n auto -m "not serial" pytest -m "serial" fi # And the test that exceeds a localhost HTTPS server tests/test_datasette_https_server.sh - name: Upload coverage report if: ${{ matrix.coverage }} uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} files: coverage.xml - name: Black run: | black --version black --check . - name: Ruff run: ruff check datasette tests - name: Check if cog needs to be run run: | cog --check docs/*.rst - name: Check if blacken-docs needs to be run run: | # This fails on syntax errors, or a diff was applied blacken-docs -l 60 docs/*.rst - name: Test DATASETTE_LOAD_PLUGINS run: | pip install datasette-init datasette-json-html tests/test-datasette-load-plugins.sh