|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | test: |
11 | | - runs-on: ubuntu-latest |
| 11 | + runs-on: ${{ matrix.os }} |
12 | 12 | strategy: |
13 | 13 | matrix: |
| 14 | + os: [ubuntu-latest, macos-latest, windows-latest] |
14 | 15 | python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
15 | 16 |
|
16 | 17 | steps: |
|
21 | 22 | with: |
22 | 23 | python-version: ${{ matrix.python-version }} |
23 | 24 |
|
| 25 | + - name: Install SQLite on Linux |
| 26 | + if: runner.os == 'Linux' |
| 27 | + run: | |
| 28 | + sudo apt-get update |
| 29 | + sudo apt-get install -y sqlite3 libsqlite3-dev |
| 30 | +
|
| 31 | + - name: Install SQLite on macOS |
| 32 | + if: runner.os == 'macOS' |
| 33 | + run: | |
| 34 | + brew update |
| 35 | + brew install sqlite |
| 36 | + # Ensure Homebrew sqlite is first on PATH for the job |
| 37 | + echo "PATH=$(brew --prefix sqlite)/bin:$PATH" >> $GITHUB_ENV |
| 38 | +
|
| 39 | + - name: Install SQLite on Windows |
| 40 | + if: runner.os == 'Windows' |
| 41 | + shell: powershell |
| 42 | + run: | |
| 43 | + choco install sqlite -y |
| 44 | + # Chocolatey puts sqlite3.exe in C:\ProgramData\chocolatey\bin which is on PATH |
| 45 | +
|
| 46 | + - name: Show sqlite version |
| 47 | + run: sqlite3 --version |
| 48 | + |
| 49 | + - name: Assert sqlite >= 3.41 (Linux/macOS) |
| 50 | + if: runner.os != 'Windows' |
| 51 | + run: | |
| 52 | + python - <<'PY' |
| 53 | + import sys, subprocess |
| 54 | + try: |
| 55 | + out = subprocess.check_output(['sqlite3', '--version']).decode().split()[0] |
| 56 | + except Exception as e: |
| 57 | + print('Could not run sqlite3 --version:', e) |
| 58 | + sys.exit(1) |
| 59 | + parts = out.split('.') |
| 60 | + major = int(parts[0]) if len(parts) > 0 else 0 |
| 61 | + minor = int(parts[1]) if len(parts) > 1 else 0 |
| 62 | + if (major, minor) < (3, 41): |
| 63 | + print(f'Found sqlite {out}; sqlite >= 3.41 is required.') |
| 64 | + sys.exit(1) |
| 65 | + print('sqlite OK', out) |
| 66 | + PY |
| 67 | +
|
| 68 | + - name: Assert sqlite >= 3.41 (Windows) |
| 69 | + if: runner.os == 'Windows' |
| 70 | + shell: powershell |
| 71 | + run: | |
| 72 | + $ver = (sqlite3 --version).Split()[0] |
| 73 | + $parts = $ver.Split('.') |
| 74 | + $major = [int]$parts[0] |
| 75 | + $minor = [int]$parts[1] |
| 76 | + if ($major -lt 3 -or ($major -eq 3 -and $minor -lt 41)) { |
| 77 | + Write-Error "Found sqlite $ver; sqlite >= 3.41 is required." |
| 78 | + exit 1 |
| 79 | + } |
| 80 | + Write-Host "sqlite OK $ver" |
| 81 | +
|
24 | 82 | - name: Install dependencies |
25 | 83 | run: | |
26 | 84 | python -m pip install --upgrade pip |
|
0 commit comments