Skip to content

Commit

Permalink
Pull command construction into separate script
Browse files Browse the repository at this point in the history
[integration]
  • Loading branch information
SevInf committed Jul 18, 2024
1 parent c065662 commit cc0967e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
28 changes: 1 addition & 27 deletions .github/workflows/build-engines-linux-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,33 +122,7 @@ jobs:
run: |
set -eux;
# full command
command="docker run \
-e SQLITE_MAX_VARIABLE_NUMBER=250000 \
-e SQLITE_MAX_EXPR_DEPTH=10000 \
-e LIBZ_SYS_STATIC=1 \
-w /root/build \
-v \"$(pwd)\":/root/build \
-v \"$HOME\"/.cargo/bin:/root/cargo/bin \
-v \"$HOME\"/.cargo/registry/index:/root/cargo/registry/index \
-v \"$HOME\"/.cargo/registry/cache:/root/cargo/registry/cache \
-v \"$HOME\"/.cargo/git/db:/root/cargo/git/db \
$IMAGE \
bash -c \
\" \
cargo clean \
&& cargo build --release -p query-engine --manifest-path query-engine/query-engine/Cargo.toml $TARGET_STRING $FEATURES_STRING \
&& cargo build --release -p query-engine-node-api --manifest-path query-engine/query-engine-node-api/Cargo.toml $TARGET_STRING $FEATURES_STRING \
&& cargo build --release -p schema-engine-cli --manifest-path schema-engine/cli/Cargo.toml $TARGET_STRING $FEATURES_STRING \
&& cargo build --release -p prisma-fmt --manifest-path prisma-fmt/Cargo.toml $TARGET_STRING $FEATURES_STRING \
\" \
"
# remove query-engine-node-api for "static" targets
if [[ "$TARGET_NAME" == *-static-* ]]; then
substring_to_replace="&& cargo build --release -p query-engine-node-api --manifest-path query-engine/query-engine-node-api/Cargo.toml $TARGET_STRING $FEATURES_STRING"
replacement_string=""
command=$(echo "$command" | sed "s|$substring_to_replace|$replacement_string|")
fi
command=$(bash .github/workflows/utils/constructDockerBuildCommand.sh)
# store command in GitHub output
echo "COMMAND=$command" >> "$GITHUB_OUTPUT"
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/utils/constructDockerBuildCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
set -eux;

# full command
command="docker run \
-e SQLITE_MAX_VARIABLE_NUMBER=250000 \
-e SQLITE_MAX_EXPR_DEPTH=10000 \
-e LIBZ_SYS_STATIC=1 \
-w /root/build \
-v \"$(pwd)\":/root/build \
-v \"$HOME\"/.cargo/bin:/root/cargo/bin \
-v \"$HOME\"/.cargo/registry/index:/root/cargo/registry/index \
-v \"$HOME\"/.cargo/registry/cache:/root/cargo/registry/cache \
-v \"$HOME\"/.cargo/git/db:/root/cargo/git/db \
$IMAGE \
bash -c \
\" \
cargo clean \
&& cargo build --release -p query-engine --manifest-path query-engine/query-engine/Cargo.toml $TARGET_STRING $FEATURES_STRING \
&& cargo build --release -p query-engine-node-api --manifest-path query-engine/query-engine-node-api/Cargo.toml $TARGET_STRING $FEATURES_STRING \
&& cargo build --release -p schema-engine-cli --manifest-path schema-engine/cli/Cargo.toml $TARGET_STRING $FEATURES_STRING \
&& cargo build --release -p prisma-fmt --manifest-path prisma-fmt/Cargo.toml $TARGET_STRING $FEATURES_STRING \
\" \
"
# remove query-engine-node-api for "static" targets
if [[ "$TARGET_NAME" == *-static-* ]]; then
substring_to_replace="&& cargo build --release -p query-engine-node-api --manifest-path query-engine/query-engine-node-api/Cargo.toml $TARGET_STRING $FEATURES_STRING"
replacement_string=""
command=$(echo "$command" | sed "s|$substring_to_replace|$replacement_string|")
fi

0 comments on commit cc0967e

Please sign in to comment.