-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description - Update CI - Fix DockerFile for quivr-core tests - Tox parallel tests @StanGirard @chloedia - For running quivr-core tests: ```bash cd backend/core ./scripts/run_tests.sh ``` --------- Co-authored-by: aminediro <aminedirhoussi@gmail.com> Co-authored-by: Stan Girard <girard.stanislas@gmail.com>
- Loading branch information
1 parent
2d64962
commit d9c1f3a
Showing
5 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Constants | ||
IMAGE_NAME="quivr-core-test" | ||
IMAGE_TAG="latest" | ||
DOCKERFILE="Dockerfile.test" | ||
VOLUME_MAPPING="$PWD:/code" | ||
CMD="poetry run tox" | ||
PLATFORM="linux/amd64" | ||
BUILDER_NAME="amd64_builder" | ||
|
||
# Functions | ||
build_image() { | ||
echo "Building Docker image for $PLATFORM..." | ||
EXISTING_BUILDER=$(docker buildx ls | grep -w $BUILDER_NAME) | ||
|
||
# Create the builder if it doesn't exist | ||
if [ -z "$EXISTING_BUILDER" ]; then | ||
echo "Creating builder: $BUILDER_NAME" | ||
docker buildx create --use --name $BUILDER_NAME --platform $PLATFORM | ||
else | ||
echo "Builder $BUILDER_NAME already exists. Skipping creation." | ||
fi | ||
|
||
docker buildx build --platform $PLATFORM -f $DOCKERFILE -t $IMAGE_NAME:$IMAGE_TAG --load . | ||
} | ||
|
||
run_container() { | ||
echo "Running tests in Docker container..." | ||
docker run -it --rm --platform $PLATFORM -v $VOLUME_MAPPING $IMAGE_NAME:$IMAGE_TAG $CMD | ||
} | ||
|
||
# Main script execution | ||
build_image | ||
run_container | ||
|
||
echo "Tests completed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters