conditionally exclude some crates when target os is windows or macos

This commit is contained in:
wileyj
2024-02-29 11:42:26 -08:00
parent 9385b42360
commit e00243f81f
9 changed files with 15 additions and 93 deletions

View File

@@ -1,78 +0,0 @@
## Github workflow to create multiarch binaries from source
name: Create Binaries for x86_64
on:
workflow_call:
inputs:
tag:
description: "Tag name of this release (x.y.z)"
required: true
type: string
arch:
description: "Stringified JSON object listing of platform matrix"
required: false
type: string
default: >-
["linux-glibc-x64", "linux-musl-x64", "macos-x64", "windows-x64"]
cpu:
description: "Stringified JSON object listing of target CPU matrix"
required: false
type: string
default: >-
["x86-64", "x86-64-v3"]
## change the display name to the tag being built
run-name: ${{ inputs.tag }}
concurrency:
group: create-binary-${{ github.head_ref || github.ref || github.run_id}}
## Only cancel in progress if this is for a PR
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
## Runs when the following is true:
## - tag is provided
## - workflow is building default branch (master)
artifact:
if: |
inputs.tag != '' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
name: Build Binaries
runs-on: ubuntu-latest
strategy:
## Run a maximum of 10 builds concurrently, using the matrix defined in inputs.arch
max-parallel: 10
matrix:
platform: ${{ fromJson(inputs.arch) }}
cpu: ${{ fromJson(inputs.cpu) }}
steps:
## Setup Docker for the builds
- name: Docker setup
uses: stacks-network/actions/docker@main
## Build the binaries using defined dockerfiles
- name: Build Binary (${{ matrix.platform }}_${{ matrix.cpu }})
id: build_binaries
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # 5.0.0
with:
file: build-scripts/Dockerfile.${{ matrix.platform }}
outputs: type=local,dest=./release/${{ matrix.platform }}
build-args: |
STACKS_NODE_VERSION=${{ inputs.tag || env.GITHUB_SHA_SHORT }}
OS_ARCH=${{ matrix.platform }}
TARGET_CPU=${{ matrix.cpu }}
GIT_BRANCH=${{ env.GITHUB_REF_SHORT }}
GIT_COMMIT=${{ env.GITHUB_SHA_SHORT }}
## Compress the binary artifact
- name: Compress artifact
id: compress_artifact
run: zip --junk-paths ${{ matrix.platform }}_${{ matrix.cpu }} ./release/${{ matrix.platform }}/*
## Upload the binary artifact to the github action (used in `github-release.yml` to create a release)
- name: Upload artifact
id: upload_artifact
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
path: ${{ matrix.platform }}_${{ matrix.cpu }}.zip

View File

@@ -56,6 +56,6 @@ developer-mode = []
slog_json = ["stacks_common/slog_json"]
testing = []
[target.'cfg(all(target_arch = "x86_64", not(target_env = "msvc")))'.dependencies]
[target.'cfg(all(target_arch = "x86_64", not(any(target_os="windows"))))'.dependencies]
sha2-asm = "0.5.3"

View File

@@ -44,8 +44,8 @@ features = ["arbitrary_precision", "unbounded_depth"]
version = "0.24.3"
features = ["serde", "recovery"]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(target_env = "msvc")))'.dependencies]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
sha2 = { version = "0.10", features = ["asm"] }
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), target_env = "msvc"))'.dependencies]
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), any(target_os = "windows")))'.dependencies]
sha2 = { version = "0.10" }

View File

@@ -26,8 +26,8 @@ clarity = { path = "../clarity" }
version = "0.24.3"
features = ["serde", "recovery"]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(target_env = "msvc")))'.dependencies]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
sha2 = { version = "0.10", features = ["asm"] }
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), target_env = "msvc"))'.dependencies]
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), any(target_os = "windows")))'.dependencies]
sha2 = { version = "0.10" }

View File

@@ -78,8 +78,8 @@ developer-mode = []
slog_json = ["slog-json"]
testing = []
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(target_env = "msvc")))'.dependencies]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
sha2 = { version = "0.10", features = ["asm"] }
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), target_env = "msvc"))'.dependencies]
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), any(target_os="windows")))'.dependencies]
sha2 = { version = "0.10" }

View File

@@ -59,7 +59,7 @@ siphasher = "0.3.7"
wsts = { workspace = true }
hashbrown = { workspace = true }
[target.'cfg(not(target_env = "msvc"))'.dependencies]
[target.'cfg(not(any(target_os = "macos",target_os="windows", target_arch = "arm" )))'.dependencies]
tikv-jemallocator = {workspace = true}
[target.'cfg(unix)'.dependencies]
@@ -114,8 +114,8 @@ monitoring_prom = ["prometheus"]
slog_json = ["slog-json", "stacks-common/slog_json", "clarity/slog_json", "pox-locking/slog_json"]
testing = []
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(target_env = "msvc")))'.dependencies]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"), not(any(target_os="windows"))))'.dependencies]
sha2 = { version = "0.10", features = ["asm"] }
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), target_env = "msvc"))'.dependencies]
[target.'cfg(any(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")), any(target_os="windows")))'.dependencies]
sha2 = { version = "0.10" }

View File

@@ -26,10 +26,10 @@ extern crate stacks_common;
#[macro_use(o, slog_log, slog_trace, slog_debug, slog_info, slog_warn, slog_error)]
extern crate slog;
#[cfg(not(target_env = "msvc"))]
#[cfg(not(any(target_os = "macos", target_os = "windows", target_arch = "arm")))]
use tikv_jemallocator::Jemalloc;
#[cfg(not(target_env = "msvc"))]
#[cfg(not(any(target_os = "macos", target_os = "windows", target_arch = "arm")))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;

View File

@@ -32,7 +32,7 @@ rand = { workspace = true }
rand_core = { workspace = true }
hashbrown = { workspace = true }
[target.'cfg(not(target_env = "msvc"))'.dependencies]
[target.'cfg(not(any(target_os = "macos", target_os="windows", target_arch = "arm")))'.dependencies]
tikv-jemallocator = {workspace = true}
[dev-dependencies]

View File

@@ -43,7 +43,7 @@ use stacks::chainstate::coordinator::{get_next_recipients, OnChainRewardSetProvi
use stacks::chainstate::stacks::address::PoxAddress;
use stacks::chainstate::stacks::db::blocks::DummyEventDispatcher;
use stacks::chainstate::stacks::db::StacksChainState;
#[cfg(not(target_env = "msvc"))]
#[cfg(not(any(target_os = "macos", target_os = "windows", target_arch = "arm")))]
use tikv_jemallocator::Jemalloc;
pub use self::burnchains::{
@@ -60,7 +60,7 @@ use crate::mockamoto::MockamotoNode;
use crate::neon_node::{BlockMinerThread, TipCandidate};
use crate::run_loop::boot_nakamoto;
#[cfg(not(target_env = "msvc"))]
#[cfg(not(any(target_os = "macos", target_os = "windows", target_arch = "arm")))]
#[global_allocator]
static GLOBAL: Jemalloc = Jemalloc;