Treat warnings as errors on CI builds (#2651)

This commit is contained in:
Yuri Astrakhan 2023-07-31 22:29:07 +02:00 committed by GitHub
parent a824e8468c
commit a8a0579713
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 12 deletions

View file

@ -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

View file

@ -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

View file

@ -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 {

View file

@ -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)?;