diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9c186d2310..0e0c81403e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,28 +25,13 @@ jobs: override: true components: rustfmt, clippy - # Exclude validator API on Windows - uses: actions-rs/cargo@v1 - if: ${{ matrix.os == 'windows-latest' }} - with: - command: build - args: --all --exclude nym-validator-api - - - uses: actions-rs/cargo@v1 - if: ${{ matrix.os != 'windows-latest' }} with: command: build args: --all - # Exclude validator API on Windows - - uses: actions-rs/cargo@v1 - if: ${{ matrix.os == 'windows-latest' }} - with: - command: test - args: --all --exclude nym-validator-api - uses: actions-rs/cargo@v1 - if: ${{ matrix.os != 'windows-latest' }} with: command: test args: --all @@ -56,15 +41,8 @@ jobs: command: fmt args: --all -- --check - # Exclude validator API on Windows - uses: actions-rs/cargo@v1 - if: ${{ matrix.rust != 'nightly' && matrix.os == 'windows-latest' }} - with: - command: clippy - args: --all --exclude nym-validator-api -- -D warnings - - - uses: actions-rs/cargo@v1 - if: ${{ matrix.rust != 'nightly' && matrix.os != 'windows-latest' }} + if: ${{ matrix.rust != 'nightly' }} with: command: clippy args: -- -D warnings diff --git a/validator-api/build.rs b/validator-api/build.rs index 506d7ad7e9..a46399c281 100644 --- a/validator-api/build.rs +++ b/validator-api/build.rs @@ -4,9 +4,9 @@ use std::env; #[tokio::main] async fn main() { let out_dir = env::var("OUT_DIR").unwrap(); - let database_path = format!("sqlite://{}/validator-api-example.sqlite", out_dir); + let database_path = format!("{}/validator-api-example.sqlite", out_dir); - let mut conn = SqliteConnection::connect(&*format!("{}?mode=rwc", database_path)) + let mut conn = SqliteConnection::connect(&*format!("sqlite://{}?mode=rwc", database_path)) .await .expect("Failed to create SQLx database connection"); @@ -15,5 +15,11 @@ async fn main() { .await .expect("Failed to perform SQLx migrations"); - println!("cargo:rustc-env=DATABASE_URL={}", &database_path); + #[cfg(target_family = "unix")] + println!("cargo:rustc-env=DATABASE_URL=sqlite://{}", &database_path); + + #[cfg(target_family = "windows")] + // for some strange reason we need to add a leading `/` to the windows path even though it's + // not a valid windows path... but hey, it works... + println!("cargo:rustc-env=DATABASE_URL=sqlite:///{}", &database_path); }