Skip to content

Commit 7d97d65

Browse files
committed
Introduce log groups for GitHub Actions
1 parent 085786f commit 7d97d65

File tree

4 files changed

+54
-12
lines changed

4 files changed

+54
-12
lines changed

scripts/analysis/analyze.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ REPORT_COMPILATIONS_SCRIPTS_DIRECTORY=${REPORT_COMPILATIONS_SCRIPTS_DIRECTORY:-"
3939
SETTINGS_PROFILE_SCRIPTS_DIRECTORY=${SETTINGS_PROFILE_SCRIPTS_DIRECTORY:-"profiles"} # Repository directory that contains scripts containing settings
4040
ARTIFACTS_DIRECTORY=${ARTIFACTS_DIRECTORY:-"artifacts"} # Working directory containing the artifacts to be analyzed
4141
SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-"source"}
42+
LOG_GROUP_START=${LOG_GROUP_START:-"::group::"} # Prefix to start a log group. Defaults to GitHub Actions log group start command.
43+
LOG_GROUP_END=${LOG_GROUP_END:-"::endgroup::"} # Prefix to end a log group. Defaults to GitHub Actions log group end command.
4244

4345
# Function to display script usage
4446
usage() {
@@ -127,15 +129,21 @@ echo "analyze: Using analysis settings profile script ${SETTINGS_PROFILE_SCRIPT}
127129
source "${SETTINGS_PROFILE_SCRIPT}"
128130

129131
# Setup Tools
132+
echo "${LOG_GROUP_START}Setup Tools";
130133
source "${SCRIPTS_DIR}/setupNeo4j.sh"
131134
source "${SCRIPTS_DIR}/setupJQAssistant.sh"
132135
source "${SCRIPTS_DIR}/startNeo4j.sh"
136+
echo "${LOG_GROUP_END}";
133137

134138
# Scan and analyze artifacts when they were changed
139+
echo "${LOG_GROUP_START}Scan and Analyze Changed Artifacts";
135140
source "${SCRIPTS_DIR}/resetAndScanChanged.sh"
141+
echo "${LOG_GROUP_END}";
136142

137143
# Prepare and validate graph database before analyzing and creating reports
144+
echo "${LOG_GROUP_START}Prepare Analysis";
138145
source "${SCRIPTS_DIR}/prepareAnalysis.sh"
146+
echo "${LOG_GROUP_END}";
139147

140148
if ${exploreMode}; then
141149
echo "analyze: Explore mode activated. Report generation will be skipped. Neo4j keeps running."
@@ -149,4 +157,6 @@ echo "analyze: Creating Reports with ${REPORT_COMPILATION_SCRIPT} ..."
149157
source "${REPORT_COMPILATION_SCRIPT}"
150158

151159
# Stop Neo4j at the end
152-
source "${SCRIPTS_DIR}/stopNeo4j.sh"
160+
echo "${LOG_GROUP_START}Finishing Analysis";
161+
source "${SCRIPTS_DIR}/stopNeo4j.sh"
162+
echo "${LOG_GROUP_END}";

scripts/reports/compilations/CsvReports.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
99
set -o errexit -o pipefail
1010

11+
# Overrideable Constants (defaults also defined in sub scripts)
12+
LOG_GROUP_START=${LOG_GROUP_START:-"::group::"} # Prefix to start a log group. Defaults to GitHub Actions log group start command.
13+
LOG_GROUP_END=${LOG_GROUP_END:-"::endgroup::"} # Prefix to end a log group. Defaults to GitHub Actions log group end command.
14+
1115
## Get this "scripts/reports/compilations" directory if not already set.
1216
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
1317
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
@@ -19,7 +23,14 @@ REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR:-$(dirname -- "${REPORT_COMPILATIONS_SCR
1923
echo "CsvReports: REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR}"
2024

2125
# Run all report scripts
22-
for report_script_file in "${REPORTS_SCRIPT_DIR}"/*Csv.sh; do
23-
echo "CsvReports: Starting ${report_script_file}...";
26+
for report_script_file in "${REPORTS_SCRIPT_DIR}"/*Csv.sh; do
27+
report_script_filename=$(basename -- "${report_script_file}")
28+
29+
echo "${LOG_GROUP_START}${report_script_file}";
30+
echo "CsvReports: $(date +'%Y-%m-%dT%H:%M:%S%z') Starting ${report_script_filename}...";
31+
2432
source "${report_script_file}"
25-
done
33+
34+
echo "CsvReports: $(date +'%Y-%m-%dT%H:%M:%S%z') Finished ${report_script_filename}";
35+
echo "${LOG_GROUP_END}";
36+
done

scripts/reports/compilations/JupyterReports.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
1212
set -o errexit -o pipefail
1313

14+
# Overrideable Constants (defaults also defined in sub scripts)
15+
LOG_GROUP_START=${LOG_GROUP_START:-"::group::"} # Prefix to start a log group. Defaults to GitHub Actions log group start command.
16+
LOG_GROUP_END=${LOG_GROUP_END:-"::endgroup::"} # Prefix to end a log group. Defaults to GitHub Actions log group end command.
17+
1418
## Get this "scripts/reports/compilations" directory if not already set.
1519
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
1620
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
@@ -29,9 +33,15 @@ echo "JupyterReports: SCRIPTS_DIR=${SCRIPTS_DIR}"
2933
JUPYTER_NOTEBOOK_DIRECTORY=${JUPYTER_NOTEBOOK_DIRECTORY:-"${SCRIPTS_DIR}/../jupyter"} # Repository directory containing the Jupyter Notebooks
3034
echo "JupyterReports: JUPYTER_NOTEBOOK_DIRECTORY=${JUPYTER_NOTEBOOK_DIRECTORY}"
3135

32-
# Run all report scripts
36+
# Run all jupiter notebooks
3337
for jupyter_notebook_file in "${JUPYTER_NOTEBOOK_DIRECTORY}"/*.ipynb; do
34-
jupyter_notebook_file=$( basename "${jupyter_notebook_file}")
35-
echo "JupyterReports: Executing ${jupyter_notebook_file}...";
36-
source "${SCRIPTS_DIR}/executeJupyterNotebookReport.sh" --jupyterNotebook "${jupyter_notebook_file}"
38+
jupyter_notebook_filename=$(basename -- "${jupyter_notebook_file}")
39+
40+
echo "${LOG_GROUP_START}${jupyter_notebook_filename}";
41+
echo "JupyterReports: $(date +'%Y-%m-%dT%H:%M:%S%z') Starting ${jupyter_notebook_filename}...";
42+
43+
source "${SCRIPTS_DIR}/executeJupyterNotebookReport.sh" --jupyterNotebook "${jupyter_notebook_filename}"
44+
45+
echo "JupyterReports: $(date +'%Y-%m-%dT%H:%M:%S%z') Finished ${jupyter_notebook_filename}";
46+
echo "${LOG_GROUP_END}";
3747
done

scripts/reports/compilations/VisualizationReports.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
# Fail on any error ("-e" = exit on first error, "-o pipefail" exist on errors within piped commands)
1212
set -o errexit -o pipefail
1313

14+
# Overrideable Constants (defaults also defined in sub scripts)
15+
LOG_GROUP_START=${LOG_GROUP_START:-"::group::"} # Prefix to start a log group. Defaults to GitHub Actions log group start command.
16+
LOG_GROUP_END=${LOG_GROUP_END:-"::endgroup::"} # Prefix to end a log group. Defaults to GitHub Actions log group end command.
17+
1418
## Get this "scripts/reports/compilations" directory if not already set.
1519
# Even if $BASH_SOURCE is made for Bourne-like shells it is also supported by others and therefore here the preferred solution.
1620
# CDPATH reduces the scope of the cd command to potentially prevent unintended directory changes.
@@ -21,8 +25,15 @@ echo "VisualizationReports: REPORT_COMPILATIONS_SCRIPT_DIR=${REPORT_COMPILATIONS
2125
REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR:-$(dirname -- "${REPORT_COMPILATIONS_SCRIPT_DIR}")}
2226
echo "VisualizationReports: REPORTS_SCRIPT_DIR=${REPORTS_SCRIPT_DIR}"
2327

24-
# Run all report scripts
25-
for report_script_file in "${REPORTS_SCRIPT_DIR}"/*Visualization.sh; do
26-
echo "VisualizationReports: Starting ${report_script_file}...";
27-
source "${report_script_file}"
28+
# Run all visualization scripts
29+
for visualization_script_file in "${REPORTS_SCRIPT_DIR}"/*Visualization.sh; do
30+
visualization_script_filename=$(basename -- "${visualization_script_file}")
31+
32+
echo "${LOG_GROUP_START}${visualization_script_filename}";
33+
echo "VisualizationReports: $(date +'%Y-%m-%dT%H:%M:%S%z') Starting ${visualization_script_filename}...";
34+
35+
source "${visualization_script_file}"
36+
37+
echo "VisualizationReports: $(date +'%Y-%m-%dT%H:%M:%S%z') Finished ${visualization_script_filename}";
38+
echo "${LOG_GROUP_END}";
2839
done

0 commit comments

Comments
 (0)