Skip to content

Commit 15b4cf5

Browse files
committed
Use different SQLite versions in CI
1 parent 88dc27d commit 15b4cf5

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.github/workflows/phpunit-tests-run.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ on:
1717
required: false
1818
type: 'string'
1919
default: 'phpunit.xml.dist'
20+
sqlite:
21+
description: 'SQLite version to install (e.g., 3.24.0). Leave empty for latest version.'
22+
required: false
23+
type: 'string'
24+
default: 'latest'
2025
env:
2126
LOCAL_PHP: ${{ inputs.php }}-fpm
2227
PHPUNIT_CONFIG: ${{ inputs.phpunit-config }}
@@ -31,12 +36,37 @@ jobs:
3136
- name: Checkout repository
3237
uses: actions/checkout@v4
3338

39+
- name: Set up SQLite
40+
run: |
41+
VERSION=${{ inputs.sqlite }}
42+
if [ "$VERSION" = "latest" ]; then
43+
VERSION="release"
44+
fi
45+
wget -O sqlite.tar.gz "https://sqlite.org/src/tarball/sqlite.tar.gz?r=${VERSION}"
46+
tar xzf sqlite.tar.gz
47+
cd sqlite
48+
./configure --prefix=/usr/local
49+
make -j$(nproc)
50+
make install
51+
ldconfig
52+
3453
- name: Set up PHP
3554
uses: shivammathur/setup-php@v2
3655
with:
3756
php-version: '${{ inputs.php }}'
3857
tools: phpunit-polyfills
3958

59+
- name: Verify SQLite version in PHP
60+
run: |
61+
EXPECTED=${{ inputs.sqlite }}
62+
PDO=$(php -r "echo (new PDO('sqlite::memory'))->query('SELECT SQLITE_VERSION();')->fetch()[0];")
63+
echo "Expected SQLite version: $EXPECTED"
64+
echo "PHP PDO SQLite version: $PDO"
65+
if [ "$EXPECTED" != "latest" ] && [ "$EXPECTED" != "$PDO" ]; then
66+
echo "Error: Expected SQLite version $EXPECTED, but PHP PDO uses $PDO"
67+
exit 1
68+
fi
69+
4070
- name: Install Composer dependencies
4171
uses: ramsey/composer-install@v3
4272
with:

.github/workflows/phpunit-tests.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010
test:
11-
name: PHP ${{ matrix.php }}
11+
name: PHP ${{ matrix.php }}${{ matrix.sqlite && format(' / SQLite {0}', matrix.sqlite) || '' }}
1212
uses: ./.github/workflows/phpunit-tests-run.yml
1313
permissions:
1414
contents: read
@@ -18,8 +18,22 @@ jobs:
1818
matrix:
1919
os: [ ubuntu-latest ]
2020
php: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
21+
sqlite: [ '' ] # Default: use system SQLite
22+
include:
23+
# Add specific SQLite versions for specific PHP versions here:
24+
- php: '7.2'
25+
sqlite: '3.27.0' # minimum version with WP_SQLITE_UNSAFE_ENABLE_UNSUPPORTED_VERSIONS
26+
- php: '7.3'
27+
sqlite: '3.34.1' # Debian 11 (Bullseye), common with PHP < 8.1
28+
- php: '7.4'
29+
sqlite: '3.37.0' # minimum supported version (STRICT table support)
30+
- php: '8.0'
31+
sqlite: '3.40.1' # Debian 12 (Bookworm)
32+
- php: '8.1'
33+
sqlite: '3.46.1' # Debian 13 (Trixie), Ubuntu >= 24.10
2134

2235
with:
2336
os: ${{ matrix.os }}
2437
php: ${{ matrix.php }}
38+
sqlite: ${{ matrix.sqlite }}
2539
phpunit-config: ${{ 'phpunit.xml.dist' }}

0 commit comments

Comments
 (0)