Skip to content

Record GitLab job queue timing #450

Record GitLab job queue timing

Record GitLab job queue timing #450

Workflow file for this run

name: Shellcheck
on:
pull_request:
paths:
- "scripts/*.sh"
- "scripts/**/*.sh"
- "programs/**/*.sh"
- "benchpark-bridge/scripts/*.sh"
- "benchpark-bridge/scripts/**/*.sh"
- ".github/workflows/shellcheck.yml"
push:
branches:
- "**"
paths:
- "scripts/*.sh"
- "scripts/**/*.sh"
- "programs/**/*.sh"
- "benchpark-bridge/scripts/*.sh"
- "benchpark-bridge/scripts/**/*.sh"
- ".github/workflows/shellcheck.yml"
workflow_dispatch:
jobs:
shellcheck:
name: shellcheck -S error
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install shellcheck-py
run: python -m pip install --quiet shellcheck-py
- name: Run bash syntax checks and shellcheck at error level
shell: bash
run: |
set -euo pipefail
mapfile -t files < <(find scripts/ programs/ benchpark-bridge/scripts/ -name "*.sh" 2>/dev/null | sort)
if [ "${#files[@]}" -eq 0 ]; then
echo "No shell files found; nothing to check."
exit 0
fi
echo "Checking ${#files[@]} shell files with bash -n"
for file in "${files[@]}"; do
bash -n "$file"
done
echo "bash syntax: 0"
echo "Checking ${#files[@]} shell files at -S error level"
shellcheck -S error -f gcc "${files[@]}"
echo "shellcheck error-level: 0"
- name: Run warning-level shellcheck on changed app scripts
if: github.event_name == 'pull_request'
shell: bash
run: |
set -euo pipefail
git fetch --no-tags --depth=1 origin "+refs/heads/${GITHUB_BASE_REF}:refs/remotes/origin/${GITHUB_BASE_REF}"
mapfile -t files < <(
git diff --name-only --diff-filter=ACMRT "origin/${GITHUB_BASE_REF}...HEAD" -- ':(glob)programs/**/*.sh' |
sort
)
if [ "${#files[@]}" -eq 0 ]; then
echo "No changed app shell files found; warning-level shellcheck skipped."
exit 0
fi
echo "Checking ${#files[@]} changed app shell files at -S warning level"
shellcheck -S warning -f gcc "${files[@]}"
echo "changed app shellcheck warning-level: 0"