Skip to content

Commit 6d234c7

Browse files
committed
add cfg attrs in tests that implicitly depended on features
Fix CI checks, remove Actix, gate macro tests - Align `cargo check` features with CI matrix runtime/TLS. - Use `--lib --tests` for `cargo check` instead of `--all-targets`.
1 parent 9495442 commit 6d234c7

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

.github/workflows/sqlx.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-22.04
2020
strategy:
2121
matrix:
22-
runtime: [async-std, tokio, actix]
22+
runtime: [async-std, tokio]
2323
tls: [native-tls, rustls]
2424
steps:
2525
- uses: actions/checkout@v4
@@ -38,8 +38,8 @@ jobs:
3838
- run:
3939
cargo check
4040
--no-default-features
41-
--all-targets
42-
--features offline,all-databases,migrate,runtime-tokio-rustls,macros
41+
--lib --tests
42+
--features offline,all-databases,migrate,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros
4343

4444
test:
4545
name: Unit Test

tests/any/pool.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ async fn big_pool() -> anyhow::Result<()> {
9898
}
9999

100100
#[sqlx_macros::test]
101+
#[cfg(feature = "macros")]
101102
async fn test_pool_callbacks() -> anyhow::Result<()> {
102103
#[derive(sqlx_oldapi::FromRow, Debug, PartialEq, Eq)]
103104
struct ConnStats {

tests/mssql/mssql.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ async fn it_can_prepare_then_execute() -> anyhow::Result<()> {
363363
// MSSQL-specific copy of the test case in `tests/any/pool.rs`
364364
// because MSSQL has its own bespoke syntax for temporary tables.
365365
#[sqlx_macros::test]
366+
#[cfg(feature = "macros")]
366367
async fn test_pool_callbacks() -> anyhow::Result<()> {
367368
#[derive(sqlx_oldapi::FromRow, Debug, PartialEq, Eq)]
368369
struct ConnStats {
@@ -505,6 +506,7 @@ async fn it_can_decode_tinyint_as_i16() -> anyhow::Result<()> {
505506
}
506507

507508
#[sqlx_macros::test]
509+
#[cfg(feature = "macros")]
508510
async fn it_works_with_query_builder() -> anyhow::Result<()> {
509511
let mut conn = new::<Mssql>().await?;
510512

@@ -579,6 +581,7 @@ CREATE TABLE #qb_test (
579581
}
580582

581583
#[sqlx_macros::test]
584+
#[cfg(feature = "macros")]
582585
async fn it_executes_query_from_issue_11() -> anyhow::Result<()> {
583586
// https://github.com/sqlpage/sqlx-oldapi/issues/11
584587
let mut conn = new::<Mssql>().await?;

tests/postgres/postgres.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ CREATE TABLE heating_bills (
11601160
}
11611161

11621162
#[sqlx_macros::test]
1163+
#[cfg(feature = "macros")]
11631164
async fn it_resolves_custom_type_in_array() -> anyhow::Result<()> {
11641165
// Only supported in Postgres 11+
11651166
let mut conn = new::<Postgres>().await?;
@@ -1247,6 +1248,7 @@ VALUES
12471248
}
12481249

12491250
#[sqlx_macros::test]
1251+
#[cfg(feature = "macros")]
12501252
async fn it_resolves_custom_types_in_anonymous_records() -> anyhow::Result<()> {
12511253
use sqlx_core::error::Error;
12521254
// This request involves nested records and array types.
@@ -1632,6 +1634,7 @@ async fn it_encodes_custom_array_issue_1504() -> anyhow::Result<()> {
16321634
}
16331635

16341636
#[sqlx_macros::test]
1637+
#[cfg(feature = "macros")]
16351638
async fn test_issue_1254() -> anyhow::Result<()> {
16361639
#[derive(sqlx_oldapi::Type)]
16371640
#[sqlx(type_name = "pair")]

0 commit comments

Comments
 (0)