2020-08-18 05:09:34 +00:00
|
|
|
name: Test
|
|
|
|
|
2022-04-24 14:10:13 +00:00
|
|
|
on: [push, pull_request]
|
2020-08-18 05:09:34 +00:00
|
|
|
|
2022-05-31 19:28:40 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-08-18 05:09:34 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-09-06 16:16:27 +00:00
|
|
|
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
2020-08-18 05:09:34 +00:00
|
|
|
steps:
|
2022-10-25 14:13:43 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-08-18 05:09:34 +00:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2022-10-25 14:13:43 +00:00
|
|
|
uses: actions/setup-python@v4
|
2020-08-18 05:09:34 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2023-09-06 16:16:27 +00:00
|
|
|
allow-prereleases: true
|
2022-10-25 14:13:43 +00:00
|
|
|
- uses: actions/cache@v3
|
2020-08-18 05:09:34 +00:00
|
|
|
name: Configure pip caching
|
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pip-
|
2022-08-24 00:11:45 +00:00
|
|
|
- name: Build extension for --load-extension test
|
|
|
|
run: |-
|
|
|
|
(cd tests && gcc ext.c -fPIC -shared -o ext.so)
|
2020-08-18 05:09:34 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2024-02-16 05:11:47 +00:00
|
|
|
pip install uv
|
2024-02-16 05:15:32 +00:00
|
|
|
uv venv
|
2024-02-16 05:16:53 +00:00
|
|
|
source .venv/bin/activate
|
2024-02-16 05:11:47 +00:00
|
|
|
uv pip install -e '.[test]'
|
|
|
|
uv pip freeze
|
2020-08-18 05:09:34 +00:00
|
|
|
- name: Run tests
|
|
|
|
run: |
|
2024-02-16 05:18:37 +00:00
|
|
|
source .venv/bin/activate
|
2022-12-15 21:05:33 +00:00
|
|
|
pytest -n auto -m "not serial"
|
|
|
|
pytest -m "serial"
|
2022-12-18 02:38:26 +00:00
|
|
|
# And the test that exceeds a localhost HTTPS server
|
|
|
|
tests/test_datasette_https_server.sh
|
2023-08-29 00:38:32 +00:00
|
|
|
- name: Install docs dependencies on Python 3.9+
|
|
|
|
if: matrix.python-version != '3.8'
|
|
|
|
run: |
|
2024-02-16 05:18:37 +00:00
|
|
|
source .venv/bin/activate
|
2023-08-29 00:38:32 +00:00
|
|
|
pip install -e '.[docs]'
|
2022-01-13 21:35:54 +00:00
|
|
|
- name: Check if cog needs to be run
|
2023-08-29 00:38:32 +00:00
|
|
|
if: matrix.python-version != '3.8'
|
2022-01-13 21:35:54 +00:00
|
|
|
run: |
|
2024-02-16 05:18:37 +00:00
|
|
|
source .venv/bin/activate
|
2022-01-13 21:35:54 +00:00
|
|
|
cog --check docs/*.rst
|
2022-04-24 15:50:43 +00:00
|
|
|
- name: Check if blacken-docs needs to be run
|
2023-08-29 00:38:32 +00:00
|
|
|
if: matrix.python-version != '3.8'
|
2022-04-24 15:50:43 +00:00
|
|
|
run: |
|
2024-02-16 05:18:37 +00:00
|
|
|
source .venv/bin/activate
|
2022-04-24 16:17:59 +00:00
|
|
|
# This fails on syntax errors, or a diff was applied
|
2022-04-24 15:50:43 +00:00
|
|
|
blacken-docs -l 60 docs/*.rst
|
2023-08-30 22:12:24 +00:00
|
|
|
- name: Test DATASETTE_LOAD_PLUGINS
|
|
|
|
run: |
|
2024-02-16 05:18:37 +00:00
|
|
|
source .venv/bin/activate
|
2023-08-30 22:12:24 +00:00
|
|
|
pip install datasette-init datasette-json-html
|
|
|
|
tests/test-datasette-load-plugins.sh
|