Bugfix/validator api windows build (#791)
* Use https://github.com/nymtech/nym/pull/784/commits/3eceb349c695372cbb7a3bee9aa5e090da7c9c4d trick to make build.rs work with windows * Re-enabled validator-api windows CI build
This commit is contained in:
committed by
GitHub
parent
9a65e44166
commit
23ea82952e
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user