Skip to content

build: add shellcheck hook #4026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .ci/build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ LATEST=3 # for 'latest-ubuntu' and 'latest-ubuntu-student'
# Run only ubuntu jobs
ONLY_UBUNTU="${ONLY_UBUNTU:-false}"

# Default authenticated user flag
AUTH_USER="${AUTH_USER:-false}"

# On remote
ON_REMOTE="${ON_REMOTE:-false}"

Expand Down Expand Up @@ -89,7 +92,7 @@ for version in "${versions[@]}"; do
echo "Processing $counter"
echo " - Version: $version"
echo " - extended_testing: $extended_testing"
echo " - auth_user: $auth_user"
echo " - AUTH_USER: $AUTH_USER"
echo " - Student: $ON_STUDENT"
echo " - Ubuntu: $ON_UBUNTU"

Expand All @@ -111,15 +114,15 @@ for version in "${versions[@]}"; do
continue
fi

# Skipping student versions on auth_user
# if [[ "$auth_user" == "true" && "$ON_STUDENT" == "true" ]]; then
# Skipping student versions on AUTH_USER
# if [[ "$AUTH_USER" == "true" && "$ON_STUDENT" == "true" ]]; then
# echo "Skipping student versions when user is authenticated"
# echo ""
# continue
# fi

# main logic
if [[ "$auth_user" == "true" ]]; then
if [[ "$AUTH_USER" == "true" ]]; then
if [[ "$extended_testing" == "true" ]]; then
# runs everything
add_line="true";
Expand Down Expand Up @@ -165,4 +168,4 @@ JSON="$JSON]}"
echo "$JSON"

# Set output
echo "matrix=$( echo "$JSON" )" >> $GITHUB_OUTPUT
echo "matrix=$( echo "${JSON}" )" >> $GITHUB_OUTPUT
32 changes: 27 additions & 5 deletions .ci/collect_mapdl_logs_locals.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
#!/bin/bash
#
# Script Name: collect_mapdl_logs_locals.sh
# Description: Collects MAPDL log files from local runs for debugging or archiving purposes.
#
# Usage:
# bash .ci/collect_mapdl_logs_locals.sh
#
# Required Environment Variables:
# MAPDL_LOGS_DIR - Directory containing MAPDL log files to collect.
# OUTPUT_DIR - Directory where collected logs will be copied or archived.
#
# Optional Environment Variables:
# LOG_FILE_PATTERN - Pattern to match log files (default: "*.log").
#
# Example:
# export MAPDL_LOGS_DIR=~/tmp/ansys_tmp/logs
# export OUTPUT_DIR=~/collected_logs
# bash .ci/collect_mapdl_logs_locals.sh
#
# Note:
# Ensure you have the necessary permissions to read from MAPDL_LOGS_DIR and write to

mkdir "$LOG_NAMES" && echo "Successfully generated directory $LOG_NAMES"

echo "Copying the log files..."
mv *.log ./"$LOG_NAMES"/ || echo "No log files could be found"
mv *apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found"
mv *pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found"
mv ./*.log ./"$LOG_NAMES"/ || echo "No log files could be found"
mv ./*apdl.out ./"$LOG_NAMES"/ || echo "No APDL log files could be found"
mv ./*pymapdl.apdl ./"$LOG_NAMES"/ || echo "No PYMAPDL APDL log files could be found"

echo "Copying the profiling files..."
mkdir -p ./"$LOG_NAMES"/prof
mv prof/* ./"$LOG_NAMES"/prof || echo "No profile files could be found"

echo "Copying the JSONL files..."
mv *.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"
mv ./*.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"

ls -la ./"$LOG_NAMES"

echo "Tar files..."
tar --remove-files -cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress"
tar --remove-files -cvzf ./"$LOG_NAMES".tgz ./"$LOG_NAMES" || echo "Failed to compress"
2 changes: 1 addition & 1 deletion .ci/collect_mapdl_logs_remote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mkdir -p ./"$LOG_NAMES"/prof
mv prof/* ./"$LOG_NAMES"/prof || echo "No profile files could be found"

echo "Moving the JSONL files..."
mv *.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"
mv ./*.jsonl ./"$LOG_NAMES"/ || echo "No JSONL files could be found"

echo "Collecting file structure..."
ls -R > ./"$LOG_NAMES"/files_structure.txt || echo "Failed to copy file structure to a file"
Expand Down
16 changes: 16 additions & 0 deletions .ci/display_logs_locals.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
#!/bin/bash
# display_logs_locals.sh
#
# This script displays local log files generated during CI or local development runs.
# It is intended to help developers and CI systems quickly access and review logs
# for debugging and verification purposes.
#
# Usage:
# ./display_logs_locals.sh
#
# Typical log directories or files displayed include:
# - logs-local-latest-ubuntu-student/apdl.out
# - Any other relevant log files in the workspace
#
# Modify this script as needed to include additional log files or directories.


#####
# Displaying files
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/codespaces-docs/start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/bash
#!/bin/bash
# Script to activate the venv, and install the PyMAPDL
echo "Starting Documentation codespaces"

Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer-local/start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/bash
#!/bin/bash
# Script to create the venv, and install the dependencies
echo "Starting local development container"

Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ ci:


repos:
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.16.0
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/4026.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build: add shellcheck hook
8 changes: 4 additions & 4 deletions doc/start_webserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

LOG_FILE="$(pwd)/webserver.log"
echo "You can find the web server log in: $LOG_FILE"
echo "Web server logs" > $LOG_FILE
echo "==============" >> $LOG_FILE
echo "Web server logs" > "${LOG_FILE}"
echo "==============" >> "${LOG_FILE}"

$(cd _build/html && python -m http.server>> $LOG_FILE 2>&1) & echo -n "$!" > webserver.pid
cd _build/html && python -m http.server>> "${LOG_FILE}" 2>&1 & echo -n "$!" > webserver.pid

echo "The pid of the web server is $(cat webserver.pid)"
sleep 0.5

cat $LOG_FILE | grep -q "Traceback" && echo "ERROR starting the web server" && tail -n +3 $LOG_FILE || \
cat "$LOG_FILE" | grep -q "Traceback" && echo "ERROR starting the web server" && tail -n +3 ${LOG_FILE} || \
(echo "Server started at port 8000." && \
echo "If you don't see a pop up with 'Open in browser'," && \
echo "you can open the port from the 'PORTS' tab by" && \
Expand Down
Loading