From 490ec8f49caa9c9cbf226390255d146b69b02f20 Mon Sep 17 00:00:00 2001 From: Iker Barriocanal <32816711+iker-barriocanal@users.noreply.github.com> Date: Thu, 20 Jun 2024 09:06:09 +0200 Subject: [PATCH] build(Makefile): Add `--locked` flag to cargo build,test,doc (#3743) --- .github/workflows/beta.yml | 1 + .github/workflows/build_binary.yml | 1 + .github/workflows/build_library.yml | 5 +++-- .github/workflows/ci.yml | 1 + .github/workflows/deploy.yml | 1 + Makefile | 13 +++++++------ 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 4ca3f4ff03..e2f7267958 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -6,6 +6,7 @@ on: env: CARGO_TERM_COLOR: always + RELAY_CARGO_ARGS: "--locked" jobs: test-all: diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index 2aabf84629..fcc2227a2b 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -7,6 +7,7 @@ on: env: CARGO_TERM_COLOR: always + RELAY_CARGO_ARGS: "--locked" jobs: linux: diff --git a/.github/workflows/build_library.yml b/.github/workflows/build_library.yml index 52f962f0dc..e8421e9338 100644 --- a/.github/workflows/build_library.yml +++ b/.github/workflows/build_library.yml @@ -7,6 +7,7 @@ on: env: CARGO_TERM_COLOR: always + RELAY_CARGO_ARGS: "--locked" jobs: linux: @@ -68,7 +69,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.10" - name: Build Wheel run: | @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36afb52468..ce76176078 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ concurrency: env: CARGO_TERM_COLOR: always + RELAY_CARGO_ARGS: "--locked" jobs: lint: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6535ae3c3a..5c6b5ed95d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,6 +10,7 @@ on: env: CARGO_TERM_COLOR: always + RELAY_CARGO_ARGS: "--locked" jobs: cargo_docs: diff --git a/Makefile b/Makefile index cfc23b0e06..13b4ad999e 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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,} @@ -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 @@ -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