forked from NYCU-SDC/backend-training-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_test.sh
executable file
·24 lines (19 loc) · 881 Bytes
/
docker_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
# Define a function to print a separator that matches the terminal width
print_separator() {
local message=" $1 " # Get the function argument as the message
local term_width=$(tput cols) # Get the terminal width
local equals_width=$(( (term_width - ${#message}) / 2 )) # Calculate the number of equal signs
# Output the separator line
printf '%*s' "$equals_width" | tr ' ' '='
printf '%s' "$message"
printf '%*s\n' "$equals_width" | tr ' ' '='
}
print_separator "Check files change"
./.github/scripts/check_files.sh
print_separator "Install requirements"
docker exec -t -w "/mnt/app" fastapi_app pip install --quiet -r requirements.txt
print_separator "Run pytest"
docker exec -t -w "/mnt" fastapi_app sh -c "rm -f /mnt/test*"
docker exec -t -w "/mnt" fastapi_app cp -fr .github/scripts/* ./
docker exec -t -w "/mnt" fastapi_app pytest