mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-11-10 19:07:11 +01:00
CI: pin shellcheck, and enable Actions on the repo
Two things kept CI from being green, and neither was the code.
First, GitHub Actions was DISABLED at the repository level. The workflows
registered fine and simply never ran -- `gh api .../actions/permissions`
returned {"enabled": false}. Now enabled.
Second, once it ran, shellcheck failed on a file that is clean locally:
SC2236 in PSD/zin3/python/run_temperature_system.sh. `language: system` hooks
use whatever is on PATH, and Ubuntu's packaged shellcheck is not the 0.11.0
this machine has, so the build went red for a difference in tool version
rather than in the code. That is the failure mode testsAndMisc pins tools to
avoid, so the workflow now installs shellcheck v0.11.0 and verifies its
SHA256 -- checked here first: the digest matches and the archive really does
unpack to shellcheck-v0.11.0/shellcheck.
The `! -z` -> `-n` fix is applied too. Pinning stops the next version drift;
fixing the code means this instance is right under either version.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
This commit is contained in:
parent
7515bd0dc2
commit
0928dfdd13
19
.github/workflows/pre-commit.yml
vendored
19
.github/workflows/pre-commit.yml
vendored
@ -33,8 +33,23 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: "3.x"
|
python-version: "3.x"
|
||||||
|
|
||||||
- name: Install shellcheck
|
# Pinned, not apt-installed. `language: system` hooks run whatever is on
|
||||||
run: sudo apt-get update -qq && sudo apt-get install -y -qq shellcheck
|
# PATH, so an unpinned shellcheck makes CI disagree with every developer
|
||||||
|
# machine: Ubuntu's package flagged SC2236 in a file that 0.11.0 locally
|
||||||
|
# does not, and the build went red for a difference in tool version
|
||||||
|
# rather than in the code.
|
||||||
|
- name: Install shellcheck (pinned)
|
||||||
|
env:
|
||||||
|
SHELLCHECK_VERSION: v0.11.0
|
||||||
|
SHELLCHECK_SHA256: 8c3be12b05d5c177a04c29e3c78ce89ac86f1595681cab149b65b97c4e227198
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
url="https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz"
|
||||||
|
curl -fsSL "$url" -o /tmp/sc.tar.xz
|
||||||
|
echo "${SHELLCHECK_SHA256} /tmp/sc.tar.xz" | sha256sum -c -
|
||||||
|
tar -xJf /tmp/sc.tar.xz -C /tmp
|
||||||
|
sudo install -m 0755 "/tmp/shellcheck-${SHELLCHECK_VERSION}/shellcheck" /usr/local/bin/shellcheck
|
||||||
|
shellcheck --version
|
||||||
|
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@ -31,17 +31,17 @@ cleanup() {
|
|||||||
echo -e "${YELLOW}Shutting down the temperature monitoring system...${NC}"
|
echo -e "${YELLOW}Shutting down the temperature monitoring system...${NC}"
|
||||||
|
|
||||||
# Kill all background processes
|
# Kill all background processes
|
||||||
if [[ ! -z $GENERATOR_PID ]]; then
|
if [[ -n "${GENERATOR_PID}" ]]; then
|
||||||
echo "Stopping temperature generator..."
|
echo "Stopping temperature generator..."
|
||||||
kill $GENERATOR_PID 2>/dev/null || true
|
kill $GENERATOR_PID 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z $DETECTOR_PID ]]; then
|
if [[ -n "${DETECTOR_PID}" ]]; then
|
||||||
echo "Stopping anomaly detector..."
|
echo "Stopping anomaly detector..."
|
||||||
kill $DETECTOR_PID 2>/dev/null || true
|
kill $DETECTOR_PID 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z $VISUALIZER_PID ]]; then
|
if [[ -n "${VISUALIZER_PID}" ]]; then
|
||||||
echo "Stopping alarm visualizer..."
|
echo "Stopping alarm visualizer..."
|
||||||
kill $VISUALIZER_PID 2>/dev/null || true
|
kill $VISUALIZER_PID 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user