Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macos runner #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,52 +13,52 @@ jobs:
run: exit 0

check-msrv:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Run Checks MSRV
run: ./ci.sh check msrv

test-msrv:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Run Tests MSRV
run: ./ci.sh test msrv

clippy:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Run Clippy
run: ./ci.sh clippy

test-stable:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Run Tests stable
run: ./ci.sh test stable

test-nightly:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- uses: actions/checkout@v2
- name: Run Tests nightly
run: ./ci.sh test nightly

#check-stable:
#runs-on: ubuntu-22.04
#steps:
#- uses: actions/checkout@v2
#- name: Run Tests
#run: ./ci.sh check stable

#check-nightly:
#runs-on: ubuntu-22.04
#continue-on-error: true
#steps:
#- uses: actions/checkout@v2
#- name: Run Tests
#run: ./ci.sh check nightly
8 changes: 8 additions & 0 deletions examples/benchmark.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use std::cmp;
Expand Down Expand Up @@ -58,6 +60,12 @@ fn client(kind: Client) {

static CLIENT_DONE: AtomicBool = AtomicBool::new(false);

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
#[cfg(feature = "log")]
utils::setup_logging("info");
Expand Down
8 changes: 8 additions & 0 deletions examples/client.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use log::debug;
Expand All @@ -10,6 +12,12 @@ use smoltcp::socket::tcp;
use smoltcp::time::Instant;
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv6Address};

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
utils::setup_logging("");

Expand Down
9 changes: 8 additions & 1 deletion examples/dhcp_client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(clippy::option_map_unit_fn)]
#![allow(dead_code, unused, clippy::option_map_unit_fn)]

mod utils;

use log::*;
Expand All @@ -13,6 +14,12 @@ use smoltcp::{
time::Duration,
};

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
#[cfg(feature = "log")]
utils::setup_logging("");
Expand Down
8 changes: 8 additions & 0 deletions examples/dns.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use smoltcp::iface::{Config, Interface, SocketSet};
Expand All @@ -8,6 +10,12 @@ use smoltcp::time::Instant;
use smoltcp::wire::{DnsQueryType, EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv6Address};
use std::os::unix::io::AsRawFd;

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
utils::setup_logging("warn");

Expand Down
8 changes: 8 additions & 0 deletions examples/httpclient.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use log::debug;
Expand All @@ -11,6 +13,12 @@ use smoltcp::socket::tcp;
use smoltcp::time::Instant;
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv6Address};

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
utils::setup_logging("");

Expand Down
8 changes: 8 additions & 0 deletions examples/multicast.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use std::os::unix::io::AsRawFd;
Expand All @@ -14,6 +16,12 @@ use smoltcp::wire::{
const MDNS_PORT: u16 = 5353;
const MDNS_GROUP: [u8; 4] = [224, 0, 0, 251];

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
utils::setup_logging("warn");

Expand Down
8 changes: 8 additions & 0 deletions examples/multicast6.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use std::os::unix::io::AsRawFd;
Expand All @@ -23,6 +25,12 @@ const GROUP: [u16; 8] = [0xff02, 0, 0, 0, 0, 0, 0, 0x1234];
const LOCAL_ADDR: [u16; 8] = [0xfe80, 0, 0, 0, 0, 0, 0, 0x101];
const ROUTER_ADDR: [u16; 8] = [0xfe80, 0, 0, 0, 0, 0, 0, 0x100];

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
utils::setup_logging("warn");

Expand Down
8 changes: 8 additions & 0 deletions examples/ping.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use byteorder::{ByteOrder, NetworkEndian};
Expand Down Expand Up @@ -56,6 +58,12 @@ macro_rules! get_icmp_pong {
}};
}

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
utils::setup_logging("warn");

Expand Down
8 changes: 8 additions & 0 deletions examples/server.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code, unused)]

mod utils;

use log::debug;
Expand All @@ -10,6 +12,12 @@ use smoltcp::socket::{tcp, udp};
use smoltcp::time::{Duration, Instant};
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv6Address};

#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn main() {
panic!("This example only works on Linux or Android (with tun/tap support)");
}

#[cfg(any(target_os = "linux", target_os = "android"))]
fn main() {
utils::setup_logging("");

Expand Down
12 changes: 9 additions & 3 deletions examples/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(dead_code)]
#![allow(dead_code, unused)]

#[cfg(feature = "log")]
use env_logger::Builder;
Expand All @@ -12,7 +12,10 @@ use std::process;
use std::str::{self, FromStr};
use std::time::{SystemTime, UNIX_EPOCH};

#[cfg(feature = "phy-tuntap_interface")]
#[cfg(all(
feature = "phy-tuntap_interface",
any(target_os = "linux", target_os = "android")
))]
use smoltcp::phy::TunTapInterface;
use smoltcp::phy::{Device, FaultInjector, Medium, Tracer};
use smoltcp::phy::{PcapMode, PcapWriter};
Expand Down Expand Up @@ -96,7 +99,10 @@ pub fn add_tuntap_options(opts: &mut Options, _free: &mut [&str]) {
opts.optopt("", "tap", "TAP interface to use", "tap0");
}

#[cfg(feature = "phy-tuntap_interface")]
#[cfg(all(
feature = "phy-tuntap_interface",
any(target_os = "linux", target_os = "android")
))]
pub fn parse_tuntap_options(matches: &mut Matches) -> TunTapInterface {
let tun = matches.opt_str("tun");
let tap = matches.opt_str("tap");
Expand Down
Loading