mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
Treat warnings as errors on CI builds (#2651)
This commit is contained in:
parent
a824e8468c
commit
a8a0579713
4 changed files with 21 additions and 12 deletions
5
.github/workflows/examples.yml
vendored
5
.github/workflows/examples.yml
vendored
|
@ -33,6 +33,8 @@ jobs:
|
|||
--release
|
||||
--no-default-features
|
||||
--features mysql,postgres,sqlite
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
@ -157,10 +159,9 @@ jobs:
|
|||
# so we only check that it compiles.
|
||||
- name: Chat (Check)
|
||||
uses: actions-rs/cargo@v1
|
||||
env:
|
||||
with:
|
||||
command: check
|
||||
args: -p sqlx-example-postgres-check
|
||||
args: -p sqlx-example-postgres-chat
|
||||
|
||||
- name: Files (Setup)
|
||||
working-directory: examples/postgres/files
|
||||
|
|
14
.github/workflows/sqlx.yml
vendored
14
.github/workflows/sqlx.yml
vendored
|
@ -55,6 +55,8 @@ jobs:
|
|||
--manifest-path sqlx-core/Cargo.toml
|
||||
--no-default-features
|
||||
--features json,offline,migrate,_rt-${{ matrix.runtime }},_tls-${{ matrix.tls }}
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
|
@ -62,6 +64,8 @@ jobs:
|
|||
args: >
|
||||
--no-default-features
|
||||
--features all-databases,_unstable-all-types,runtime-${{ matrix.runtime }},tls-${{ matrix.tls }},macros
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
|
||||
test:
|
||||
name: Unit Test
|
||||
|
@ -211,7 +215,7 @@ jobs:
|
|||
env:
|
||||
SQLX_OFFLINE: true
|
||||
SQLX_OFFLINE_DIR: .sqlx
|
||||
RUSTFLAGS: --cfg sqlite_ipaddr
|
||||
RUSTFLAGS: -D warnings --cfg sqlite_ipaddr
|
||||
LD_LIBRARY_PATH: /tmp/sqlite3-lib
|
||||
|
||||
# Test macros in offline mode (still needs DATABASE_URL to run)
|
||||
|
@ -255,7 +259,7 @@ jobs:
|
|||
env:
|
||||
# FIXME: needed to disable `ltree` tests in Postgres 9.6
|
||||
# but `PgLTree` should just fall back to text format
|
||||
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
|
||||
RUSTFLAGS: -D warnings --cfg postgres_${{ matrix.postgres }}
|
||||
with:
|
||||
command: build
|
||||
args: >
|
||||
|
@ -311,7 +315,7 @@ jobs:
|
|||
SQLX_OFFLINE_DIR: .sqlx
|
||||
# FIXME: needed to disable `ltree` tests in Postgres 9.6
|
||||
# but `PgLTree` should just fall back to text format
|
||||
RUSTFLAGS: --cfg postgres_${{ matrix.postgres }}
|
||||
RUSTFLAGS: -D warnings --cfg postgres_${{ matrix.postgres }}
|
||||
|
||||
# Test macros in offline mode (still needs DATABASE_URL to run)
|
||||
- uses: actions-rs/cargo@v1
|
||||
|
@ -421,7 +425,7 @@ jobs:
|
|||
env:
|
||||
SQLX_OFFLINE: true
|
||||
SQLX_OFFLINE_DIR: .sqlx
|
||||
RUSTFLAGS: --cfg mysql_${{ matrix.mysql }}
|
||||
RUSTFLAGS: -D warnings --cfg mysql_${{ matrix.mysql }}
|
||||
|
||||
# Test macros in offline mode (still needs DATABASE_URL to run)
|
||||
# MySQL 5.7 supports TLS but not TLSv1.3 as required by RusTLS.
|
||||
|
@ -517,7 +521,7 @@ jobs:
|
|||
env:
|
||||
SQLX_OFFLINE: true
|
||||
SQLX_OFFLINE_DIR: .sqlx
|
||||
RUSTFLAGS: --cfg mariadb_${{ matrix.mariadb }}
|
||||
RUSTFLAGS: -D warnings --cfg mariadb_${{ matrix.mariadb }}
|
||||
|
||||
# Test macros in offline mode (still needs DATABASE_URL to run)
|
||||
- uses: actions-rs/cargo@v1
|
||||
|
|
|
@ -39,10 +39,12 @@ pub trait DatabaseExt: Database {
|
|||
fn describe_blocking(query: &str, database_url: &str) -> sqlx_core::Result<Describe<Self>>;
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub struct CachingDescribeBlocking<DB: DatabaseExt> {
|
||||
connections: Lazy<Mutex<HashMap<String, DB::Connection>>>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl<DB: DatabaseExt> CachingDescribeBlocking<DB> {
|
||||
pub const fn new() -> Self {
|
||||
CachingDescribeBlocking {
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
use proc_macro2::{Span, TokenStream};
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::quote;
|
||||
use syn::LitStr;
|
||||
|
||||
#[cfg(feature = "migrate")]
|
||||
struct Args {
|
||||
fixtures: Vec<LitStr>,
|
||||
fixtures: Vec<syn::LitStr>,
|
||||
migrations: MigrationsOpt,
|
||||
}
|
||||
|
||||
#[cfg(feature = "migrate")]
|
||||
enum MigrationsOpt {
|
||||
InferredPath,
|
||||
ExplicitPath(LitStr),
|
||||
ExplicitPath(syn::LitStr),
|
||||
ExplicitMigrator(syn::Path),
|
||||
Disabled,
|
||||
}
|
||||
|
@ -89,7 +90,8 @@ fn expand_advanced(args: syn::AttributeArgs, input: syn::ItemFn) -> crate::Resul
|
|||
quote! { args.migrator(&#migrator); }
|
||||
}
|
||||
MigrationsOpt::InferredPath if !inputs.is_empty() => {
|
||||
let migrations_path = crate::common::resolve_path("./migrations", Span::call_site())?;
|
||||
let migrations_path =
|
||||
crate::common::resolve_path("./migrations", proc_macro2::Span::call_site())?;
|
||||
|
||||
if migrations_path.is_dir() {
|
||||
let migrator = crate::migrate::expand_migrator(&migrations_path)?;
|
||||
|
|
Loading…
Reference in a new issue