diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 1104bc1a3c..5877add8c1 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -40,7 +40,11 @@ on: jobs: build: - runs-on: [ self-hosted, custom-linux ] + strategy: + fail-fast: false + matrix: + os: [custom-linux, custom-runner-mac-m1] + runs-on: ${{ matrix.os }} env: CARGO_TERM_COLOR: always # Enable sccache via environment variable @@ -50,6 +54,7 @@ jobs: - name: Install Dependencies (Linux) run: sudo apt-get update && sudo apt-get -y install libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libudev-dev squashfs-tools protobuf-compiler continue-on-error: true + if: matrix.os == 'custom-linux' - name: Check out repository code uses: actions/checkout@v2 @@ -76,6 +81,7 @@ jobs: args: --workspace --features wireguard - name: Build all examples + if: matrix.os == 'custom-linux' uses: actions-rs/cargo@v1 with: command: build @@ -88,13 +94,14 @@ jobs: args: --workspace --features wireguard - name: Run expensive tests - if: github.ref == 'refs/heads/develop' || github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'master' + if: (github.ref == 'refs/heads/develop' || github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'master') && matrix.os == 'custom-linux' uses: actions-rs/cargo@v1 with: command: test args: --workspace --features wireguard -- --ignored - name: Annotate with clippy checks + if: matrix.os == 'custom-linux' uses: actions-rs/clippy-check@v1 continue-on-error: true with: diff --git a/common/wireguard/src/lib.rs b/common/wireguard/src/lib.rs index b42a9a6d88..15383eb335 100644 --- a/common/wireguard/src/lib.rs +++ b/common/wireguard/src/lib.rs @@ -1,20 +1,18 @@ -use nym_task::TaskClient; +#![cfg_attr(not(target_os = "linux"), allow(dead_code))] -pub use error::WgError; +use nym_task::TaskClient; mod error; -#[cfg(target_os = "linux")] mod event; -#[cfg(target_os = "linux")] +mod platform; mod setup; -#[cfg(target_os = "linux")] mod tun; -#[cfg(target_os = "linux")] -mod tun_device; -#[cfg(target_os = "linux")] mod udp_listener; +// Currently the module related to setting up the virtual network device is platform specific. #[cfg(target_os = "linux")] +use platform::linux::tun_device; + type ActivePeers = dashmap::DashMap>; diff --git a/common/wireguard/src/platform/linux/mod.rs b/common/wireguard/src/platform/linux/mod.rs new file mode 100644 index 0000000000..ebe0ba212c --- /dev/null +++ b/common/wireguard/src/platform/linux/mod.rs @@ -0,0 +1 @@ +pub(crate) mod tun_device; diff --git a/common/wireguard/src/tun_device.rs b/common/wireguard/src/platform/linux/tun_device.rs similarity index 100% rename from common/wireguard/src/tun_device.rs rename to common/wireguard/src/platform/linux/tun_device.rs diff --git a/common/wireguard/src/platform/mod.rs b/common/wireguard/src/platform/mod.rs new file mode 100644 index 0000000000..2305239628 --- /dev/null +++ b/common/wireguard/src/platform/mod.rs @@ -0,0 +1,2 @@ +#[cfg(target_os = "linux")] +pub(crate) mod linux; diff --git a/common/wireguard/src/tun.rs b/common/wireguard/src/tun.rs index 320942af12..3dbafecf32 100644 --- a/common/wireguard/src/tun.rs +++ b/common/wireguard/src/tun.rs @@ -15,7 +15,7 @@ use tokio::{ time::timeout, }; -use crate::{event::Event, WgError}; +use crate::{error::WgError, event::Event}; const MAX_PACKET: usize = 65535; diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index bb4a8e9c69..7439ab8336 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -62,8 +62,6 @@ nym-statistics-common = { path = "../common/statistics" } nym-task = { path = "../common/task" } nym-types = { path = "../common/types" } nym-validator-client = { path = "../common/client-libs/validator-client" } - -[target.'cfg(target_os = "linux")'.dependencies] nym-wireguard = { path = "../common/wireguard", optional = true } [build-dependencies]