Skip to content

Tools: Run shellcheck in GitHub Actions CI#32715

Merged
peterbarker merged 3 commits into
ArduPilot:masterfrom
cclauss:tools-run-shellcheck-in-ci
Apr 11, 2026
Merged

Tools: Run shellcheck in GitHub Actions CI#32715
peterbarker merged 3 commits into
ArduPilot:masterfrom
cclauss:tools-run-shellcheck-in-ci

Conversation

@cclauss
Copy link
Copy Markdown
Contributor

@cclauss cclauss commented Apr 8, 2026

Summary

Related to:

Tools: Run shellcheck in GitHub Actions CI

Classification & Testing (check all that apply and add your own)

  • Checked by a human programmer
  • Non-functional change
  • No-binary change
  • Infrastructure change (e.g. unit tests, helper scripts)
  • Automated test(s) verify changes (e.g. unit test, autotest)
  • Tested manually, description below (e.g. SITL)
  • Tested on hardware
  • Logs attached
  • Logs available on request

Description

Add a shellcheck job to .github/workflows/test_scripts.yml and run that in GitHub Actions.

Sort jobs to make it easier to spot missing jobs and nearly impossible to add duplicates.

Use the current Python for the performance enhancements in CI.

How was this tested?

Compare the results of:
% find . -path ./modules -prune -o -type f -name '*.sh' -exec shellcheck --severity=error '{}' +
% CI_BUILD_TARGET=shellcheck Tools/scripts/build_ci.sh
to make sure that they match while making changes to the config file .shellcheckrc.

Copy link
Copy Markdown
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI must pass; Looks like we need to exclude the modules...

But otherwise, quite in favour.

Comment thread Tools/scripts/build_ci.sh Outdated
Comment on lines +532 to +537
if [ $? -ne 0 ]; then
echo Shellcheck finds issues in shell scripts.
if [ "$CI" = "true" ]; then
exit 1 # Halt the continuous integration workflow
fi
fi
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is any of this executed?

The script is run with set -ex which should mean you never get into this block (and all of the other test types seem to rely on this)

@cclauss cclauss force-pushed the tools-run-shellcheck-in-ci branch from 94e1667 to 563e844 Compare April 9, 2026 11:36
@cclauss cclauss requested a review from peterbarker April 9, 2026 11:45
@cclauss cclauss force-pushed the tools-run-shellcheck-in-ci branch from 563e844 to bef90ac Compare April 9, 2026 12:45
@cclauss
Copy link
Copy Markdown
Contributor Author

cclauss commented Apr 9, 2026

sudo apt-get update && sudo apt-get install --yes shellcheck was adding 5 seconds to every run, so only do that
if: matrix.config == 'shellcheck'

@cclauss cclauss force-pushed the tools-run-shellcheck-in-ci branch from bef90ac to 27b2c2a Compare April 10, 2026 00:23
@cclauss cclauss force-pushed the tools-run-shellcheck-in-ci branch from 27b2c2a to f7090c3 Compare April 10, 2026 05:38
Copy link
Copy Markdown
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +32 to +33
python-version: 3.x
cache: pip # caching pip dependencies
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid patches unrelated to the PR topic,as good as they might be.

@peterbarker peterbarker merged commit 80b2e39 into ArduPilot:master Apr 11, 2026
108 checks passed
@cclauss cclauss deleted the tools-run-shellcheck-in-ci branch April 11, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants