Skip to content

Commit 46478ea

Browse files
authored
Merge pull request #13 from pabl-o-ce/feat/mssql-support
Feat/mssql support
2 parents 05c8dc1 + 3ed869d commit 46478ea

83 files changed

Lines changed: 8619 additions & 85 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/sqlx.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ jobs:
104104
-p sqlx-sqlite
105105
--all-features
106106
107+
- name: Test sqlx-mssql
108+
run: >
109+
cargo test
110+
-p sqlx-mssql
111+
--all-features
112+
107113
- name: Test sqlx-macros-core
108114
run: >
109115
cargo test
@@ -514,3 +520,78 @@ jobs:
514520
env:
515521
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
516522
RUSTFLAGS: --cfg mariadb="${{ matrix.mariadb }}"
523+
524+
mssql:
525+
name: MSSQL
526+
runs-on: ubuntu-24.04
527+
strategy:
528+
matrix:
529+
mssql: [ 2022, 2019 ]
530+
runtime: [ async-global-executor, smol, tokio ]
531+
tls: [ native-tls, rustls-aws-lc-rs, rustls-ring, none ]
532+
needs: check
533+
timeout-minutes: 30
534+
steps:
535+
- uses: actions/checkout@v4
536+
537+
- name: Setup Rust
538+
run: rustup show active-toolchain || rustup toolchain install
539+
540+
- uses: Swatinem/rust-cache@v2
541+
542+
- run: >
543+
cargo build
544+
--no-default-features
545+
--features mssql,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }},macros,migrate
546+
547+
- run: docker compose -f tests/docker-compose.yml run -d -p 1433:1433 --name mssql_${{ matrix.mssql }} mssql_${{ matrix.mssql }}
548+
- run: sleep 60
549+
550+
# Create data dir for offline mode
551+
- run: mkdir .sqlx
552+
553+
- run: >
554+
cargo test
555+
--no-default-features
556+
--features any,mssql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
557+
env:
558+
DATABASE_URL: mssql://sa:YourStrong!Passw0rd@localhost:1433/sqlx
559+
SQLX_OFFLINE_DIR: .sqlx
560+
RUSTFLAGS: --cfg mssql_${{ matrix.mssql }}
561+
562+
# Run the `test-attr` test again to cover cleanup.
563+
- run: >
564+
cargo test
565+
--test mssql-test-attr
566+
--no-default-features
567+
--features any,mssql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
568+
env:
569+
DATABASE_URL: mssql://sa:YourStrong!Passw0rd@localhost:1433/sqlx
570+
SQLX_OFFLINE_DIR: .sqlx
571+
RUSTFLAGS: --cfg mssql_${{ matrix.mssql }}
572+
573+
# Remove test artifacts
574+
- run: cargo clean -p sqlx
575+
576+
# Build the macros-test in offline mode (omit DATABASE_URL)
577+
- run: >
578+
cargo build
579+
--no-default-features
580+
--test mssql-macros
581+
--features any,mssql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
582+
env:
583+
SQLX_OFFLINE: true
584+
SQLX_OFFLINE_DIR: .sqlx
585+
RUSTFLAGS: -D warnings --cfg mssql_${{ matrix.mssql }}
586+
587+
# Test macros in offline mode (still needs DATABASE_URL to run)
588+
- run: >
589+
cargo test
590+
--no-default-features
591+
--test mssql-macros
592+
--features any,mssql,macros,migrate,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }}
593+
env:
594+
DATABASE_URL: mssql://sa:YourStrong!Passw0rd@localhost:1433/sqlx
595+
SQLX_OFFLINE: true
596+
SQLX_OFFLINE_DIR: .sqlx
597+
RUSTFLAGS: --cfg mssql_${{ matrix.mssql }}

0 commit comments

Comments
 (0)