-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from EspressoSystems/ma/async-std-default
Default to async-std
- Loading branch information
Showing
14 changed files
with
161 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,18 @@ on: | |
- cron: '0 0 * * 1' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
flags: | ||
# no flags set, default to async-std | ||
- "" | ||
# crates that explicitly choose async-std should keep working | ||
- --cfg async_executor_impl=\"async-std\" --cfg async_channel_impl=\"async-std\" | ||
- --cfg async_executor_impl=\"async-std\" --cfg async_channel_impl=\"flume\" | ||
- --cfg async_executor_impl=\"tokio\" --cfg async_channel_impl=\"tokio\" | ||
|
@@ -18,11 +25,6 @@ jobs: | |
timeout-minutes: 60 | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
steps: | ||
- uses: styfle/[email protected] | ||
name: Cancel Outdated Builds | ||
with: | ||
all_but_latest: true | ||
access_token: ${{ github.token }} | ||
|
||
- name: Install Nix | ||
uses: cachix/install-nix-action@v26 | ||
|
@@ -36,12 +38,12 @@ jobs: | |
- name: Build | ||
run: | | ||
nix develop -c RUSTFLAGS="${{ matrix.flags }}" cargo build --all-targets --workspace --release --features="logging-utils" | ||
nix develop -c env RUSTFLAGS="${{ matrix.flags }}" cargo build --all-targets --workspace --release --features="logging-utils" | ||
- name: Test | ||
run: | | ||
nix develop -c RUSTFLAGS="${{ matrix.flags }}" cargo test --all-targets --workspace --release --features="logging-utils" | ||
nix develop -c env RUSTFLAGS="${{ matrix.flags }}" cargo test --all-targets --workspace --release --features="logging-utils" | ||
- name: Lint | ||
run: | | ||
nix develop -c RUSTFLAGS="${{ matrix.flags }}" cargo clippy --all-targets --workspace --release --bins --tests --examples --features="logging-utils" -- -D warnings | ||
nix develop -c env RUSTFLAGS="${{ matrix.flags }}" cargo clippy --all-targets --workspace --release --bins --tests --examples --features="logging-utils" -- -D warnings |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "async-compatibility-layer" | ||
description = "an abstraction layer for using both async-std and tokio" | ||
authors = ["Espresso Systems <[email protected]>"] | ||
version = "1.1.0" | ||
version = "1.2.0" | ||
edition = "2021" | ||
license = "MIT" | ||
|
||
|
@@ -41,7 +41,7 @@ opentelemetry-jaeger = { version = "0.19.0", features = [ | |
], optional = true } | ||
opentelemetry-aws = { version = "0.8.0", features = ["trace"], optional = true } | ||
|
||
[target.'cfg(all(async_executor_impl = "tokio"))'.dependencies] | ||
[target.'cfg(async_executor_impl = "tokio")'.dependencies] | ||
console-subscriber = { version = "0.2.0" } | ||
tokio = { version = "1", features = [ | ||
"fs", | ||
|
@@ -60,13 +60,13 @@ tokio = { version = "1", features = [ | |
] } | ||
tokio-stream = { version = "0.1.14" } | ||
|
||
[target.'cfg(all(async_executor_impl = "async-std"))'.dependencies] | ||
[target.'cfg(not(async_executor_impl = "tokio"))'.dependencies] | ||
async-std = { version = "1.12", features = [ | ||
"attributes", | ||
"unstable", | ||
]} | ||
|
||
[target.'cfg(all(async_channel_impl = "tokio"))'.dependencies] | ||
[target.'cfg(async_channel_impl = "tokio")'.dependencies] | ||
tokio = { version = "1", features = [ | ||
"fs", | ||
"io-util", | ||
|
@@ -84,7 +84,7 @@ tokio = { version = "1", features = [ | |
] } | ||
tokio-stream = { version = "0.1.14" } | ||
|
||
[target.'cfg(all(async_channel_impl = "async-std"))'.dependencies] | ||
[target.'cfg(not(any(async_channel_impl = "tokio", async_channel_impl = "flume")))'.dependencies] | ||
async-std = { version = "1.12", features = [ | ||
"attributes", | ||
"unstable", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,27 @@ | ||
{ | ||
description = "Nll crate"; | ||
description = "A devShell example"; | ||
|
||
nixConfig = { | ||
extra-substituters = [ "https://espresso-systems-private.cachix.org" ]; | ||
extra-trusted-public-keys = [ | ||
"espresso-systems-private.cachix.org-1:LHYk03zKQCeZ4dvg3NctyCq88e44oBZVug5LpYKjPRI=" | ||
]; | ||
}; | ||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
inputs.rust-overlay.url = "github:oxalica/rust-overlay"; | ||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
utils.url = "github:numtide/flake-utils"; | ||
flake-compat = { | ||
url = "github:edolstra/flake-compat"; | ||
flake = false; | ||
}; | ||
fenix = { | ||
url = "github:nix-community/fenix"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
outputs = | ||
{ self, nixpkgs, flake-compat, utils, fenix }: | ||
utils.lib.eachDefaultSystem (system: | ||
outputs = { nixpkgs, rust-overlay, flake-utils, ... }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
fenixStable = fenix.packages.${system}.stable.withComponents [ | ||
"cargo" | ||
"clippy" | ||
"rust-src" | ||
"rustc" | ||
"rustfmt" | ||
"llvm-tools-preview" | ||
]; | ||
|
||
CARGO_TARGET_DIR = "target_dirs/nix_rustc"; | ||
|
||
rustOverlay = final: prev: { | ||
rustc = fenixStable; | ||
cargo = fenixStable; | ||
rust-src = fenixStable; | ||
}; | ||
|
||
overlays = [ (import rust-overlay) ]; | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [ rustOverlay ]; | ||
inherit system overlays; | ||
}; | ||
|
||
buildDeps = with pkgs; | ||
[ | ||
nixpkgs-fmt | ||
fenix.packages.${system}.rust-analyzer | ||
] ++ lib.optionals stdenv.isDarwin [ | ||
darwin.apple_sdk.frameworks.Security | ||
pkgs.libiconv | ||
darwin.apple_sdk.frameworks.SystemConfiguration | ||
in | ||
with pkgs; | ||
{ | ||
CARGO_TARGET_DIR = "target_dirs/nix_rustc"; | ||
devShells.default = mkShell { | ||
buildInputs = [ | ||
just | ||
rust-bin.stable.latest.default | ||
]; | ||
in { | ||
devShell = pkgs.mkShell { | ||
inherit CARGO_TARGET_DIR; | ||
buildInputs = [ fenixStable ] ++ buildDeps; | ||
}; | ||
|
||
}); | ||
} | ||
); | ||
} |
Oops, something went wrong.