1414 - uses : actions/checkout@v4
1515 - run : cargo fmt --all -- --check
1616
17-
1817 check :
1918 name : Check
2019 runs-on : ubuntu-22.04
@@ -55,26 +54,25 @@ jobs:
5554 strategy :
5655 matrix :
5756 runtime : [
58- # Disabled because of https://github.com/rust-lang/cargo/issues/12964
59- # async-std,
60- # actix,
61- tokio
62- ]
57+ # Disabled because of https://github.com/rust-lang/cargo/issues/12964
58+ # async-std,
59+ # actix,
60+ tokio,
61+ ]
6362 tls : [
64- # native-tls,
65- rustls
66- ]
63+ # native-tls,
64+ rustls,
65+ ]
6766 steps :
6867 - uses : actions/checkout@v4
6968 - uses : dtolnay/rust-toolchain@stable
7069 - uses : Swatinem/rust-cache@v2
7170 with :
7271 prefix-key : v1-sqlx
7372 save-if : ${{ false }}
74- - run :
75- cargo test
76- --manifest-path sqlx-core/Cargo.toml
77- --features offline,all-databases,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
73+ - run : cargo test
74+ --manifest-path sqlx-core/Cargo.toml
75+ --features offline,all-databases,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
7876
7977 cli :
8078 name : CLI Binaries
9290 target : x86_64-pc-windows-msvc
9391 bin : target/debug/cargo-sqlx.exe
9492 # FIXME: macOS build fails because of missing pin-project-internal
95- # - os: macOS-latest
96- # target: x86_64-apple-darwin
97- # bin: target/debug/cargo-sqlx
93+ # - os: macOS-latest
94+ # target: x86_64-apple-darwin
95+ # bin: target/debug/cargo-sqlx
9896
9997 steps :
10098 - uses : actions/checkout@v4
@@ -103,18 +101,16 @@ jobs:
103101 with :
104102 prefix-key : v1-sqlx
105103 save-if : ${{ github.ref == 'refs/heads/main' }}
106- - run :
107- cargo build
108- --manifest-path sqlx-cli/Cargo.toml
109- --bin cargo-sqlx
110- ${{ matrix.args }}
104+ - run : cargo build
105+ --manifest-path sqlx-cli/Cargo.toml
106+ --bin cargo-sqlx
107+ ${{ matrix.args }}
111108
112109 - uses : actions/upload-artifact@v4
113110 with :
114111 name : cargo-sqlx-${{ matrix.target }}
115112 path : ${{ matrix.bin }}
116113
117-
118114 sqlite :
119115 name : SQLite
120116 runs-on : ubuntu-22.04
@@ -138,12 +134,11 @@ jobs:
138134 --no-default-features \
139135 --features sqlite,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }},macros,migrate \
140136 -- -D warnings
141- - run :
142- cargo test
143- --no-default-features
144- --features any,macros,migrate,sqlite,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
145- --
146- --test-threads=1
137+ - run : cargo test
138+ --no-default-features
139+ --features any,macros,migrate,sqlite,all-types,runtime-${{ matrix.runtime }}-${{ matrix.tls }}
140+ --
141+ --test-threads=1
147142 env :
148143 DATABASE_URL : sqlite://tests/sqlite/sqlite.db
149144 RUSTFLAGS : --cfg sqlite_ipaddr
@@ -345,7 +340,7 @@ jobs:
345340 DATABASE_URL: mssql://sa:Password123!@localhost/sqlx
346341
347342 odbc :
348- name : ODBC (SQLite ODBC )
343+ name : ODBC (PostgreSQL via unixODBC )
349344 runs-on : ubuntu-22.04
350345 needs : check
351346 steps :
@@ -356,23 +351,28 @@ jobs:
356351 prefix-key : v1-sqlx
357352 shared-key : odbc
358353 save-if : ${{ github.ref == 'refs/heads/main' }}
359- - name : Install unixODBC and SQLite ODBC
354+ - name : Start Postgres (no SSL)
355+ run : |
356+ docker compose -f tests/docker-compose.yml run -d -p 5432:5432 --name postgres_16_no_ssl postgres_16_no_ssl
357+ docker exec postgres_16_no_ssl bash -c "until pg_isready; do sleep 1; done"
358+ - name : Install unixODBC and PostgreSQL ODBC driver
360359 run : |
361360 sudo apt-get update
362- sudo apt-get install -y unixodbc odbcinst odbcinst1debian2 odbc-sqlite3 sqlite3
363- # Configure a system DSN named SQLX_ODBC using SQLite3 driver
364- echo '[SQLite3]\nDescription=SQLite ODBC Driver\nDriver=libsqlite3odbc.so\nSetup=libsqlite3odbc.so\nThreading=2\n' | sudo tee -a /etc/odbcinst.ini
365- echo '[SQLX_ODBC]\nDescription=SQLx SQLite DSN\nDriver=SQLite3\nDatabase=${{ github.workspace }}/tests/sqlite/sqlite.db\n' | sudo tee -a /etc/odbc.ini
366- # Sanity check DSN
367- echo 'select 1;' | isql -v SQLX_ODBC || true
361+ sudo apt-get install -y unixodbc odbcinst odbcinst1debian2 odbc-postgresql
362+ odbcinst -j
363+ - name : Configure system/user DSN for PostgreSQL
364+ run : |
365+ cp tests/odbc.ini ~/.odbc.ini
366+ odbcinst -q -s || true
367+ echo "select 1;" | isql -v SQLX_PG_5432 || true
368368 - name : Run clippy for odbc
369369 run : |
370370 cargo clippy \
371371 --no-default-features \
372372 --features odbc,all-types,runtime-tokio-rustls,macros,migrate \
373373 -- -D warnings
374- - name : Run ODBC tests (SQLite DSN)
374+ - name : Run ODBC tests (PostgreSQL DSN)
375375 run : |
376376 cargo test --no-default-features --features any,odbc,macros,all-types,runtime-tokio-rustls -- --test odbc
377377 env :
378- DATABASE_URL : DSN=SQLX_ODBC
378+ DATABASE_URL : DSN=SQLX_PG_5432;UID=postgres;PWD=password
0 commit comments