77 - main
88 - " *-dev"
99
10+ env :
11+ MYSQL_ISOLATED_TESTS : |
12+ it_can_handle_split_packets
13+ rustsec_2024_0363
14+ PG_ISOLATED_TESTS : |
15+ test_pg_copy_chunked
16+ rustsec_2024_0363
17+ SQLITE_ISOLATED_TESTS : |
18+ rustsec_2024_0363
19+
1020jobs :
1121 format :
1222 name : Format
@@ -150,12 +160,17 @@ jobs:
150160 # Create data dir for offline mode
151161 - run : mkdir .sqlx
152162
153- - run : >
154- cargo test
155- --no-default-features
156- --features any,macros,migrate,${{ matrix.linking }},_unstable-all-types,runtime-${{ matrix.runtime }},${{ matrix.linking == 'sqlite' && 'sqlite-preupdate-hook' || ''}}
157- --
158- --test-threads=1
163+ - run : |
164+ SKIP_ARGS=()
165+ for test in $SQLITE_ISOLATED_TESTS; do
166+ SKIP_ARGS+=(--skip "$test")
167+ done
168+ cargo test \
169+ --no-default-features \
170+ --features any,macros,migrate,${{ matrix.linking }},_unstable-all-types,runtime-${{ matrix.runtime }},${{ matrix.linking == 'sqlite' && 'sqlite-preupdate-hook' || ''}} \
171+ -- \
172+ "${SKIP_ARGS[@]}" \
173+ --test-threads=1
159174 env:
160175 DATABASE_URL: sqlite:tests/sqlite/sqlite.db
161176 SQLX_OFFLINE_DIR: .sqlx
@@ -206,6 +221,37 @@ jobs:
206221 RUSTFLAGS: --cfg sqlite_ipaddr
207222 LD_LIBRARY_PATH: /tmp/sqlite3-lib
208223
224+ sqlite-isolated :
225+ name : SQLite Isolated
226+ runs-on : ubuntu-24.04
227+ needs : check
228+ timeout-minutes : 20
229+ steps :
230+ - uses : actions/checkout@v5
231+
232+ - run : mkdir /tmp/sqlite3-lib && wget -O /tmp/sqlite3-lib/ipaddr.so https://github.com/nalgeon/sqlean/releases/download/0.15.2/ipaddr.so
233+
234+ # https://blog.rust-lang.org/2025/03/02/Rustup-1.28.0.html
235+ - name : Setup Rust
236+ run : rustup show active-toolchain || rustup toolchain install
237+
238+ - uses : Swatinem/rust-cache@v2
239+
240+ - run : |
241+ for test in $SQLITE_ISOLATED_TESTS; do
242+ cargo test \
243+ --no-default-features \
244+ --features sqlite,macros,runtime-tokio \
245+ --test sqlite-rustsec \
246+ -- \
247+ --exact "$test" \
248+ --test-threads=1
249+ done
250+ env:
251+ DATABASE_URL: sqlite:tests/sqlite/sqlite.db
252+ RUSTFLAGS: --cfg sqlite_ipaddr --cfg sqlite_test_sqlcipher
253+ LD_LIBRARY_PATH: /tmp/sqlite3-lib
254+
209255 postgres :
210256 name : Postgres
211257 runs-on : ubuntu-24.04
@@ -240,10 +286,16 @@ jobs:
240286 # Create data dir for offline mode
241287 - run : mkdir .sqlx
242288
243- - run : >
244- cargo test
245- --no-default-features
246- --features any,postgres,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
289+ - run : |
290+ SKIP_ARGS=()
291+ for test in $PG_ISOLATED_TESTS; do
292+ SKIP_ARGS+=(--skip "$test")
293+ done
294+ cargo test \
295+ --no-default-features \
296+ --features any,postgres,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
297+ -- \
298+ "${SKIP_ARGS[@]}"
247299 env:
248300 DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx
249301 SQLX_OFFLINE_DIR: .sqlx
@@ -261,10 +313,16 @@ jobs:
261313 RUSTFLAGS: -D warnings --cfg postgres="${{ matrix.postgres }}"
262314
263315 - if : matrix.tls != 'none'
264- run : >
265- cargo test
266- --no-default-features
267- --features any,postgres,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
316+ run : |
317+ SKIP_ARGS=()
318+ for test in $PG_ISOLATED_TESTS; do
319+ SKIP_ARGS+=(--skip "$test")
320+ done
321+ cargo test \
322+ --no-default-features \
323+ --features any,postgres,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
324+ -- \
325+ "${SKIP_ARGS[@]}"
268326 env :
269327 DATABASE_URL : postgres://postgres:password@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=.%2Ftests%2Fcerts%2Fca.crt
270328 SQLX_OFFLINE_DIR : .sqlx
@@ -320,14 +378,52 @@ jobs:
320378 - run : |
321379 docker exec postgres_${{ matrix.postgres }}_client_ssl bash -c "until pg_isready; do sleep 1; done"
322380
323- - run : >
324- cargo test
325- --no-default-features
326- --features any,postgres,macros,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
381+ - run : |
382+ SKIP_ARGS=()
383+ for test in $PG_ISOLATED_TESTS; do
384+ SKIP_ARGS+=(--skip "$test")
385+ done
386+ cargo test \
387+ --no-default-features \
388+ --features any,postgres,macros,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
389+ -- \
390+ "${SKIP_ARGS[@]}"
327391 env:
328392 DATABASE_URL: postgres://postgres@localhost:5432/sqlx?sslmode=verify-ca&sslrootcert=.%2Ftests%2Fcerts%2Fca.crt&sslkey=.%2Ftests%2Fcerts%2Fkeys%2Fclient.key&sslcert=.%2Ftests%2Fcerts%2Fclient.crt
329393 RUSTFLAGS: -D warnings --cfg postgres="${{ matrix.postgres }}"
330394
395+ postgres-isolated :
396+ name : Postgres Isolated
397+ runs-on : ubuntu-24.04
398+ needs : check
399+ timeout-minutes : 20
400+ steps :
401+ - uses : actions/checkout@v5
402+
403+ - name : Setup Rust
404+ run : rustup show active-toolchain || rustup toolchain install
405+
406+ - uses : Swatinem/rust-cache@v2
407+
408+ - run : |
409+ docker compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_17 postgres_17
410+ docker exec postgres_17 bash -c "until pg_isready; do sleep 1; done"
411+
412+ # Run isolated Postgres tests to avoid stalling the main job.
413+ - run : |
414+ for test in $PG_ISOLATED_TESTS; do
415+ cargo test \
416+ --no-default-features \
417+ --features any,postgres,macros,_unstable-all-types,runtime-tokio,tls-none \
418+ --test postgres \
419+ -- \
420+ --exact "$test" \
421+ --test-threads=1
422+ done
423+ env:
424+ DATABASE_URL: postgres://postgres:password@localhost:5432/sqlx
425+ RUSTFLAGS: -D warnings --cfg postgres="17"
426+
331427 mysql :
332428 name : MySQL
333429 runs-on : ubuntu-24.04
@@ -349,15 +445,22 @@ jobs:
349445 - run : cargo build --features mysql,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
350446
351447 - run : docker compose -f tests/docker-compose.yml run -d -p 3306:3306 --name mysql_${{ matrix.mysql }} mysql_${{ matrix.mysql }}
352- - run : sleep 60
448+ - name : Wait for MySQL
449+ run : timeout 60s bash -c 'until docker exec mysql_${{ matrix.mysql }} mysqladmin ping -uroot -ppassword --silent; do sleep 1; done' || (docker logs mysql_${{ matrix.mysql }} && exit 1)
353450
354451 # Create data dir for offline mode
355452 - run : mkdir .sqlx
356453
357- - run : >
358- cargo test
359- --no-default-features
360- --features any,mysql,mysql-rsa,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
454+ - run : |
455+ SKIP_ARGS=()
456+ for test in $MYSQL_ISOLATED_TESTS; do
457+ SKIP_ARGS+=(--skip "$test")
458+ done
459+ cargo test \
460+ --no-default-features \
461+ --features any,mysql,mysql-rsa,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
462+ -- \
463+ "${SKIP_ARGS[@]}"
361464 env:
362465 DATABASE_URL: mysql://root:password@localhost:3306/sqlx?ssl-mode=disabled
363466 SQLX_OFFLINE_DIR: .sqlx
@@ -376,10 +479,16 @@ jobs:
376479
377480 # MySQL 5.7 supports TLS but not TLSv1.3 as required by RusTLS.
378481 - if : ${{ !(matrix.mysql == '5_7' && matrix.tls == 'rustls') }}
379- run : >
380- cargo test
381- --no-default-features
382- --features any,mysql,${{ matrix.tls == 'none' && 'mysql-rsa,' || '' }}macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
482+ run : |
483+ SKIP_ARGS=()
484+ for test in $MYSQL_ISOLATED_TESTS; do
485+ SKIP_ARGS+=(--skip "$test")
486+ done
487+ cargo test \
488+ --no-default-features \
489+ --features any,mysql,${{ matrix.tls == 'none' && 'mysql-rsa,' || '' }}macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
490+ -- \
491+ "${SKIP_ARGS[@]}"
383492 env :
384493 DATABASE_URL : mysql://root:password@localhost:3306/sqlx
385494 SQLX_OFFLINE_DIR : .sqlx
@@ -429,17 +538,55 @@ jobs:
429538 run : |
430539 docker stop mysql_${{ matrix.mysql }}
431540 docker compose -f tests/docker-compose.yml run -d -p 3306:3306 --name mysql_${{ matrix.mysql }}_client_ssl mysql_${{ matrix.mysql }}_client_ssl
432- sleep 60
541+ timeout 60s bash -c 'until docker exec mysql_${{ matrix.mysql }}_client_ssl mysqladmin ping -uroot --silent; do sleep 1; done' || (docker logs mysql_${{ matrix.mysql }}_client_ssl && exit 1)
433542
434543 - if : ${{ matrix.tls != 'none' }}
435- run : >
436- cargo test
437- --no-default-features
438- --features any,mysql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
544+ run : |
545+ SKIP_ARGS=()
546+ for test in $MYSQL_ISOLATED_TESTS; do
547+ SKIP_ARGS+=(--skip "$test")
548+ done
549+ cargo test \
550+ --no-default-features \
551+ --features any,mysql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
552+ -- \
553+ "${SKIP_ARGS[@]}"
439554 env :
440555 DATABASE_URL : mysql://root@localhost:3306/sqlx?sslmode=verify_ca&ssl-ca=.%2Ftests%2Fcerts%2Fca.crt&ssl-key=.%2Ftests%2Fcerts%2Fkeys%2Fclient.key&ssl-cert=.%2Ftests%2Fcerts%2Fclient.crt
441556 RUSTFLAGS : --cfg mysql_${{ matrix.mysql }}
442557
558+ mysql-isolated :
559+ name : MySQL Isolated
560+ runs-on : ubuntu-24.04
561+ needs : check
562+ timeout-minutes : 20
563+ steps :
564+ - uses : actions/checkout@v5
565+
566+ - name : Setup Rust
567+ run : rustup show active-toolchain || rustup toolchain install
568+
569+ - uses : Swatinem/rust-cache@v2
570+
571+ - run : docker compose -f tests/docker-compose.yml run -d -p 3306:3306 --name mysql_8 mysql_8
572+ - name : Wait for MySQL
573+ run : timeout 60s bash -c 'until docker exec mysql_8 mysqladmin ping -uroot -ppassword --silent; do sleep 1; done' || (docker logs mysql_8 && exit 1)
574+
575+ # Run isolated MySQL tests to avoid stalling the main job.
576+ - run : |
577+ for test in $MYSQL_ISOLATED_TESTS; do
578+ cargo test \
579+ --no-default-features \
580+ --features any,mysql,mysql-rsa,macros,migrate,_unstable-all-types,runtime-tokio,tls-none \
581+ --test mysql \
582+ -- \
583+ --exact "$test" \
584+ --test-threads=1
585+ done
586+ env:
587+ DATABASE_URL: mysql://root:password@localhost:3306/sqlx?ssl-mode=disabled
588+ RUSTFLAGS: --cfg mysql_8
589+
443590 mariadb :
444591 name : MariaDB
445592 runs-on : ubuntu-24.04
@@ -461,15 +608,22 @@ jobs:
461608 - run : cargo build --features mysql,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
462609
463610 - run : docker compose -f tests/docker-compose.yml run -d -p 3306:3306 --name mariadb_${{ matrix.mariadb }} mariadb_${{ matrix.mariadb }}
464- - run : sleep 30
611+ - name : Wait for MariaDB
612+ run : timeout 60s bash -c 'until docker exec mariadb_${{ matrix.mariadb }} mysqladmin ping -uroot -ppassword --silent; do sleep 1; done' || (docker logs mariadb_${{ matrix.mariadb }} && exit 1)
465613
466614 # Create data dir for offline mode
467615 - run : mkdir .sqlx
468616
469- - run : >
470- cargo test
471- --no-default-features
472- --features any,mysql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
617+ - run : |
618+ SKIP_ARGS=()
619+ for test in $MYSQL_ISOLATED_TESTS; do
620+ SKIP_ARGS+=(--skip "$test")
621+ done
622+ cargo test \
623+ --no-default-features \
624+ --features any,mysql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
625+ -- \
626+ "${SKIP_ARGS[@]}"
473627 env:
474628 DATABASE_URL: mysql://root:password@localhost:3306/sqlx
475629 SQLX_OFFLINE_DIR: .sqlx
@@ -518,13 +672,19 @@ jobs:
518672 run : |
519673 docker stop mariadb_${{ matrix.mariadb }}
520674 docker compose -f tests/docker-compose.yml run -d -p 3306:3306 --name mariadb_${{ matrix.mariadb }}_client_ssl mariadb_${{ matrix.mariadb }}_client_ssl
521- sleep 60
675+ timeout 60s bash -c 'until docker exec mariadb_${{ matrix.mariadb }}_client_ssl mysqladmin ping -uroot --silent; do sleep 1; done' || (docker logs mariadb_${{ matrix.mariadb }}_client_ssl && exit 1)
522676
523677 - if : ${{ matrix.tls != 'none' }}
524- run : >
525- cargo test
526- --no-default-features
527- --features any,mysql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
678+ run : |
679+ SKIP_ARGS=()
680+ for test in $MYSQL_ISOLATED_TESTS; do
681+ SKIP_ARGS+=(--skip "$test")
682+ done
683+ cargo test \
684+ --no-default-features \
685+ --features any,mysql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }} \
686+ -- \
687+ "${SKIP_ARGS[@]}"
528688 env :
529689 DATABASE_URL : mysql://root@localhost:3306/sqlx?sslmode=verify_ca&ssl-ca=.%2Ftests%2Fcerts%2Fca.crt&ssl-key=.%2Ftests%2Fcerts%2Fkeys%2Fclient.key&ssl-cert=.%2Ftests%2Fcerts%2Fclient.crt
530690 RUSTFLAGS : --cfg mariadb="${{ matrix.mariadb }}"
0 commit comments