diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16e5cdee7c0..683003ca9f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -93,17 +93,11 @@ jobs: - command: clippy args: --all-targets --all-features - command: make - args: build - - command: check - args: --locked --workspace + args: check --locked - command: test - args: --all-targets --all-features --workspace --exclude fuel-p2p + args: --all-targets --all-features --workspace - command: test - args: --all-targets --no-default-features --workspace --exclude fuel-p2p - # Split p2p into its own job so that it can use a single threaded runner - - command: test - args: --all-targets --all-features -p fuel-p2p -- --test-threads=1 - skip-error: true + args: --all-targets --no-default-features --workspace # disallow any job that takes longer than 45 minutes timeout-minutes: 45 continue-on-error: ${{ matrix.skip-error || false }} @@ -113,11 +107,10 @@ jobs: with: toolchain: stable - name: Install Cargo Make - uses: baptiste0928/cargo-install@v1 + uses: davidB/rust-cargo-make@v1 with: - crate: cargo-make - version: "0.35.16" - - uses: Swatinem/rust-cache@v1 + version: "0.36.0" + - uses: Swatinem/rust-cache@v2 with: key: '${{ matrix.command }} ${{ matrix.args }}' - name: ${{ matrix.command }} ${{ matrix.args }} diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 00000000000..24273518b42 --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,31 @@ +# This file inherits defaults from +# https://github.com/sagiegurari/cargo-make/blob/0.36.0/src/lib/descriptor/makefiles/stable.toml + +# This is a configuration file for the cargo plugin `cargo-make`. We use this plugin because of it's handling around +# cargo workspaces. Specifically, each task is run on workspace members indepedently, avoiding potential issues that +# arise from feature unification (https://doc.rust-lang.org/cargo/reference/features.html#feature-unification). +# Feature unification allows two unrelated crates with the same depedency to enable features on eachother. +# This is problematic when a crate is built independently (when publishing / being consumed from crates.io), +# and it implicitly depended on features enabled by other crates in the same workspace. +# While feature resolver v2 attempted to resolve this problem, it still comes up in certain scenarios. + +# Disable built-in flows +[config] +skip_core_tasks = true + +[env] +CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true + +[tasks.check] +description = "Compile code without linking. Faster than build to detect problems." +category = "Build" +command = "cargo" +args = ["check", "${@}"] +# skip compilation checks on fuel-tests since it will be tested anyways +env = { "CARGO_MAKE_WORKSPACE_SKIP_MEMBERS" = ["fuel-tests"] } + +[tasks.test] +description = "Run tests on each workspace member" +category = "Test" +command = "cargo" +args = ["test", "${@}"] diff --git a/fuel-core/Cargo.toml b/fuel-core/Cargo.toml index d0c43f61d11..c5f59380f93 100644 --- a/fuel-core/Cargo.toml +++ b/fuel-core/Cargo.toml @@ -84,7 +84,6 @@ insta = "1.8" metrics = ["dep:fuel-metrics"] default = ["rocksdb", "metrics", "debug"] debug = ["fuel-core-interfaces/debug"] -test-helpers = [] relayer = ["dep:fuel-relayer"] p2p = ["dep:fuel-p2p"] # features to enable in production, but increase build times diff --git a/fuel-core/src/service.rs b/fuel-core/src/service.rs index d9140467c57..a9536e06914 100644 --- a/fuel-core/src/service.rs +++ b/fuel-core/src/service.rs @@ -44,7 +44,6 @@ impl FuelService { Self::init_service(database, config).await } - #[cfg(any(test, feature = "test-helpers"))] /// Used to initialize a service with a pre-existing database pub async fn from_database( database: Database, diff --git a/fuel-tests/Cargo.toml b/fuel-tests/Cargo.toml index 00c9d9f6d5c..e4bee5adac8 100644 --- a/fuel-tests/Cargo.toml +++ b/fuel-tests/Cargo.toml @@ -19,7 +19,7 @@ harness = true [dependencies] async-std = "1.12" chrono = { version = "0.4", features = ["serde"] } -fuel-core = { path = "../fuel-core", features = ["test-helpers"], default-features = false } +fuel-core = { path = "../fuel-core", default-features = false } fuel-core-interfaces = { path = "../fuel-core-interfaces", features = ["test-helpers"] } fuel-gql-client = { path = "../fuel-client", features = ["test-helpers"] } fuel-txpool = { path = "../fuel-txpool" } diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 7908dc93271..08ce3e0ffd6 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -9,3 +9,6 @@ publish = false [dependencies] clap = { version = "3.1", features = ["env", "derive"] } fuel-core = { path = "../fuel-core", default-features = false } + +[features] +default = ["fuel-core/default"] \ No newline at end of file