Skip to content

Commit

Permalink
build(Makefile): Add --locked flag to cargo build,test,doc (#3743)
Browse files Browse the repository at this point in the history
  • Loading branch information
iker-barriocanal authored Jun 20, 2024
1 parent 7043987 commit 490ec8f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

env:
CARGO_TERM_COLOR: always
RELAY_CARGO_ARGS: "--locked"

jobs:
test-all:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
CARGO_TERM_COLOR: always
RELAY_CARGO_ARGS: "--locked"

jobs:
linux:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build_library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
CARGO_TERM_COLOR: always
RELAY_CARGO_ARGS: "--locked"

jobs:
linux:
Expand Down Expand Up @@ -68,7 +69,7 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.10"

- name: Build Wheel
run: |
Expand All @@ -95,7 +96,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.10"

- name: Build sdist
run: python setup.py sdist --format=zip
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ concurrency:

env:
CARGO_TERM_COLOR: always
RELAY_CARGO_ARGS: "--locked"

jobs:
lint:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
CARGO_TERM_COLOR: always
RELAY_CARGO_ARGS: "--locked"

jobs:
cargo_docs:
Expand Down
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
SHELL=/bin/bash
export RELAY_PYTHON_VERSION := python3
export RELAY_FEATURES :=
RELAY_ARGO_AGS ?= ${CARGO_ARGS}

all: check test ## run all checks and tests
.PHONY: all
Expand All @@ -16,15 +17,15 @@ clean: ## remove python virtual environment and delete cached rust files togethe
# Builds

build: setup-git ## build relay with all features enabled without debug info
cargo +stable build --all-features
cargo +stable build --all-features ${RELAY_CARGO_ARGS}
.PHONY: build

release: setup-git ## build production binary of the relay with debug info
@cd relay && cargo +stable build --release --locked $(if ${RELAY_FEATURES}, --features ${RELAY_FEATURES})
@cd relay && cargo +stable build --release $(if ${RELAY_FEATURES}, --features ${RELAY_FEATURES}) ${RELAY_CARGO_ARGS}
.PHONY: release

build-linux-release: setup-git ## build linux release of the relay
cd relay && cargo build --release --locked $(if ${RELAY_FEATURES}, --features ${RELAY_FEATURES})
cd relay && cargo build --release $(if ${RELAY_FEATURES}, --features ${RELAY_FEATURES}) ${RELAY_CARGO_ARGS}
objcopy --only-keep-debug target/${TARGET}/release/relay{,.debug}
objcopy --strip-debug --strip-unneeded target/${TARGET}/release/relay
objcopy --add-gnu-debuglink target/${TARGET}/release/relay{.debug,}
Expand Down Expand Up @@ -59,11 +60,11 @@ test: test-rust-all test-python test-integration ## run all unit and integration
.PHONY: test

test-rust: setup-git ## run tests for Rust code with default features enabled
cargo test --workspace
cargo test --workspace ${RELAY_CARGO_ARGS}
.PHONY: test-rust

test-rust-all: setup-git ## run tests for Rust code with all the features enabled
cargo test --workspace --all-features
cargo test --workspace --all-features ${RELAY_CARGO_ARGS}
.PHONY: test-rust-all

test-python: setup-git setup-venv ## run tests for Python code
Expand All @@ -81,7 +82,7 @@ doc: doc-rust ## generate all API docs
.PHONY: doc

doc-rust: setup-git ## generate API docs for Rust code
cargo doc --workspace --all-features --no-deps
cargo doc --workspace --all-features --no-deps ${RELAY_CARGO_ARGS}
.PHONY: doc-rust

# Style checking
Expand Down

0 comments on commit 490ec8f

Please sign in to comment.