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

consolidate ci and optimize build commands #604

Merged
merged 13 commits into from
Sep 13, 2022
21 changes: 7 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,11 @@ jobs:
- command: clippy
args: --all-targets --all-features
- command: make
args: build
- command: check
args: --locked --workspace
- command: test
args: --all-targets --all-features --workspace --exclude fuel-p2p
- 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: check --locked --workspace
- command: make
args: test --all-targets --all-features
- command: make
args: test --all-targets --no-default-features
# disallow any job that takes longer than 30 minutes
timeout-minutes: 30
continue-on-error: ${{ matrix.skip-error || false }}
Expand All @@ -113,10 +107,9 @@ 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"
version: "0.36.0"
- uses: Swatinem/rust-cache@v1
with:
key: '${{ matrix.command }} ${{ matrix.args }}'
Expand Down
31 changes: 31 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -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 may allows two unrelated crates with the same depedency to enable features on eachother.
Voxelot marked this conversation as resolved.
Show resolved Hide resolved
# This is problematic when a crate is build independently (when publishing / being consumed from crates.io),
Voxelot marked this conversation as resolved.
Show resolved Hide resolved
# 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", "${@}"]