Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

ci: fix windows build and add build-check job #162

Merged
merged 2 commits into from
Oct 11, 2024
Merged
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
67 changes: 67 additions & 0 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: build-check

on:
pull_request:
branches: [ main, develop ]

env:
CARGO_TERM_COLOR: always
TOOL_CHAIN: "1.81"

jobs:
extract-version:
name: extract version
runs-on: ubuntu-latest
steps:
- name: Extract version
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
id: extract_version
outputs:
VERSION: ${{ steps.extract_version.outputs.VERSION }}

build:
name: build release
runs-on: ${{ matrix.configs.os }}
needs: extract-version
strategy:
matrix:
configs:
- target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
profile: maxperf
- target: aarch64-unknown-linux-gnu
os: ubuntu-20.04
profile: maxperf
- target: x86_64-apple-darwin
os: macos-13
profile: maxperf
- target: aarch64-apple-darwin
os: macos-14
profile: maxperf
- target: x86_64-pc-windows-gnu
os: ubuntu-20.04
profile: maxperf
build:
- command: op-build
binary: op-reth
- command: bsc-build
binary: bsc-reth
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: ${{ matrix.configs.target }}
toolchain: ${{ env.TOOL_CHAIN }}
- uses: taiki-e/install-action@cross
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Apple M1 setup
if: matrix.configs.target == 'aarch64-apple-darwin'
run: |
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV

- name: Build Reth
run: make PROFILE=${{ matrix.configs.profile }} ${{ matrix.build.command }}-${{ matrix.configs.target }}
3 changes: 0 additions & 3 deletions crates/net/nat/src/net_if.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! IP resolution on non-host Docker network.

#![cfg(not(target_os = "windows"))]

use std::{io, net::IpAddr};

/// The 'eth0' interface tends to be the default interface that docker containers use to
Expand All @@ -20,7 +18,6 @@ pub enum NetInterfaceError {
}

/// Reads IP of OS interface with given name, if exists.
#[cfg(not(target_os = "windows"))]
pub fn resolve_net_if_ip(if_name: &str) -> Result<IpAddr, NetInterfaceError> {
match if_addrs::get_if_addrs() {
Ok(ifs) => {
Expand Down
2 changes: 0 additions & 2 deletions crates/node/core/src/args/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,13 @@ pub struct NetworkArgs {
/// Name of network interface used to communicate with peers.
///
/// If flag is set, but no value is passed, the default interface for docker `eth0` is tried.
#[cfg(not(target_os = "windows"))]
#[arg(long = "net-if.experimental", conflicts_with = "addr", value_name = "IF_NAME")]
pub net_if: Option<String>,
}

impl NetworkArgs {
/// Returns the resolved IP address.
pub fn resolved_addr(&self) -> IpAddr {
#[cfg(not(target_os = "windows"))]
if let Some(ref if_name) = self.net_if {
let if_name = if if_name.is_empty() { DEFAULT_NET_IF_NAME } else { if_name };
return match reth_net_nat::net_if::resolve_net_if_ip(if_name) {
Expand Down