From a9ba823e88488f66956794ba6fced5db2651ff16 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Fri, 20 Oct 2023 17:30:57 +0000 Subject: [PATCH] use CARGO env if avaliable Signed-off-by: James Sturtevant --- .github/workflows/action-build.yml | 2 ++ Makefile | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action-build.yml b/.github/workflows/action-build.yml index 0b80ecd88..1f6693c6b 100644 --- a/.github/workflows/action-build.yml +++ b/.github/workflows/action-build.yml @@ -44,6 +44,8 @@ jobs: timeout-minutes: 5 run: | make test-${{ inputs.runtime }} + with: + CARGO_TARGET_DIR: /target - name: Package artifacts if: ${{ inputs.runtime != 'common' }} shell: bash diff --git a/Makefile b/Makefile index 3d6be81b8..d4b7dba44 100644 --- a/Makefile +++ b/Makefile @@ -5,11 +5,12 @@ LN ?= ln -sf TEST_IMG_NAME ?= wasmtest:latest RUNTIMES ?= wasmedge wasmtime wasmer CONTAINERD_NAMESPACE ?= default +CARGO_TARGET_DIR?=./target ifeq ($(CARGO),cross) # Set the default target as defined in Cross.toml TARGET ?= $(shell uname -m)-unknown-linux-musl -TARGET_DIR=./target/build/$(TARGET) +TARGET_DIR=$(CARGO_TARGET_DIR)/build/$(TARGET) # When using `cross` we need to run the tests outside the `cross` container. # We stop `cargo test` from running the tests with the `--no-run` flag. # We then need to run the generate test binary manually. @@ -19,7 +20,7 @@ TEST_ARGS_SEP= --no-run --color=always --message-format=json | \ xargs -I_ ./scripts/test-runner.sh ./_ else TARGET ?= $(shell rustc --version -v | sed -En 's/host: (.*)/\1/p') -TARGET_DIR ?= ./target +TARGET_DIR ?= $(CARGO_TARGET_DIR) TEST_ARGS_SEP= -- endif