diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2a14ca17..fe2a29004 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,10 +2,19 @@ name: Continuous Integration Checks on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: strategy: matrix: + platform: [ + ubuntu-latest, + macos-latest, + windows-latest, + ] toolchain: [ stable, beta, @@ -15,9 +24,14 @@ jobs: - toolchain: stable check-fmt: true build-uniffi: true + platform: ubuntu-latest + - toolchain: stable + platform: macos-latest + - toolchain: stable + platform: windows-latest - toolchain: 1.63.0 msrv: true - runs-on: ubuntu-latest + runs-on: ${{ matrix.platform }} steps: - name: Checkout source code uses: actions/checkout@v3 @@ -44,9 +58,10 @@ jobs: if: matrix.build-uniffi run: cargo check --release --features uniffi --verbose --color always - name: Test on Rust ${{ matrix.toolchain }} + if: "matrix.platform != 'windows-latest'" run: cargo test - name: Test with UniFFI support on Rust ${{ matrix.toolchain }} - if: matrix.build-uniffi + if: "matrix.platform != 'windows-latest' && matrix.build-uniffi" run: cargo test --features uniffi - name: Check formatting on Rust ${{ matrix.toolchain }} if: matrix.check-fmt diff --git a/Cargo.toml b/Cargo.toml index f856690b3..caf960a7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,6 +70,9 @@ esplora-client = { version = "0.4", default-features = false } libc = "0.2" uniffi = { version = "0.23.0", features = ["build"], optional = true } +[target.'cfg(windows)'.dependencies] +winapi = { version = "0.3", features = ["winbase"] } + [dev-dependencies] electrsd = { version = "0.22.0", features = ["legacy", "esplora_a33e97e1", "bitcoind_23_0"] } electrum-client = "0.12.0" diff --git a/src/logger.rs b/src/logger.rs index 8153e6d53..cab62c61d 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -7,6 +7,7 @@ use lightning::util::ser::Writer; use chrono::Utc; use std::fs; +#[cfg(not(target_os = "windows"))] use std::os::unix::fs::symlink; use std::path::Path; @@ -31,14 +32,18 @@ impl FilesystemLogger { .open(log_file_path.clone()) .map_err(|e| eprintln!("ERROR: Failed to open log file: {}", e))?; - // Create a symlink to the current log file, with prior cleanup - let log_file_symlink = parent_dir.join("ldk_node_latest.log"); - if log_file_symlink.as_path().is_symlink() { - fs::remove_file(&log_file_symlink) - .map_err(|e| eprintln!("ERROR: Failed to remove log file symlink: {}", e))?; + #[cfg(not(target_os = "windows"))] + { + // Create a symlink to the current log file, with prior cleanup + let log_file_symlink = parent_dir.join("ldk_node_latest.log"); + if log_file_symlink.as_path().is_symlink() { + fs::remove_file(&log_file_symlink).map_err(|e| { + eprintln!("ERROR: Failed to remove log file symlink: {}", e) + })?; + } + symlink(&log_file_name, &log_file_symlink) + .map_err(|e| eprintln!("ERROR: Failed to create log file symlink: {}", e))?; } - symlink(&log_file_name, &log_file_symlink) - .map_err(|e| eprintln!("ERROR: Failed to create log file symlink: {}", e))?; } Ok(Self { file_path: log_file_path, level })