-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: split tests job into separate tasks
- Loading branch information
1 parent
5e25166
commit af6ea27
Showing
4 changed files
with
57 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,18 @@ jobs: | |
python -m pip install --upgrade pip poetry importlib-resources==1.5.0 | ||
poetry export --with dev -f requirements.txt --output requirements.txt | ||
pip install -r requirements.txt | ||
- name: Check dependencies | ||
run: | | ||
/bin/bash scripts/check_deps.sh | ||
- name: Check environment variables | ||
run: | | ||
/bin/bash scripts/check_env.sh | ||
- name: Validate Grafana dashboard | ||
run: | | ||
/bin/bash scripts/validate_dashboards.py ./monitoring/grafana/dashboards/ | ||
- name: Run tests | ||
run: | | ||
/bin/bash run_tests.sh | ||
- name: Run codecov | ||
uses: codecov/[email protected] | ||
run: | | ||
codecov |
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,24 @@ | ||
#!/bin/bash | ||
|
||
rc=0 | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
|
||
# Simple test to compare variables used in code and specified in conf/*.env files, allows to set ignored variables | ||
not_configurable="CW_AWS_ACCESS_KEY_ID\|CW_AWS_SECRET_ACCESS_KEY\|SLACK_WEBHOOK\|VULNERABILITY_ENV"\ | ||
"\|MINIMAL_SCHEMA\|HOSTNAME\|DB_UPGRADE_SCRIPTS_DIR\|VE_DB_USER_ADVISOR_LISTENER_PASSWORD"\ | ||
"\|VE_DB_USER_EVALUATOR_PASSWORD\|VE_DB_USER_LISTENER_PASSWORD\|VE_DB_USER_MANAGER_PASSWORD"\ | ||
"\|VE_DB_USER_TASKOMATIC_PASSWORD\|VE_DB_USER_VMAAS_SYNC_PASSWORD\|VE_DB_USER_NOTIFICATOR_PASSWORD" | ||
not_in_code="API_URLS\|CYNDI_MOCK\|PGUSER" | ||
configurable_variables=$(cat conf/*.env | grep -o "^.*=" | sed 's/.$//g' | sort -u | grep -v "$not_in_code") | ||
code_variables=$(find . -name '*.py' -not -path './.venv/*' -not -path './scripts/*' -not -path './tests/*' -not -path './database/upgrade/*' -exec grep -oP "os\.getenv.*?\)|os\.environ\.get.*?\)" {} \; | awk -F"['\"]" '{print $2}' | sort -u | grep -v "$not_configurable") | ||
diff <(echo "$configurable_variables") <(echo "$code_variables") | ||
diff_rc=$? | ||
if [ $diff_rc -gt 0 ]; then | ||
echo -e "${RED} Error: Some variables in code or conf/*.env are missing!${NC}" | ||
else | ||
echo "Variables in code and conf/*.env are OK" | ||
fi | ||
rc=$(($rc+$diff_rc)) | ||
|
||
exit $rc |
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,22 @@ | ||
#!/bin/bash | ||
|
||
rc=0 | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
|
||
# Are there duplicated configuration variables? | ||
duplicates=$(cat conf/*.env | grep -o "^.*=.*" | sort | uniq -d) | ||
duplicate_cnt=0 | ||
for dup in $duplicates | ||
do | ||
echo "$dup" | ||
duplicate_cnt=$(($duplicate_cnt+1)) | ||
done | ||
if [ $duplicate_cnt -gt 0 ]; then | ||
echo -e "${RED} Error: Duplicated variables were found!${NC}" | ||
rc=$(($rc+1)) | ||
else | ||
echo "Variables are unique." | ||
fi | ||
|
||
exit $rc |