Skip to content

Update README.md

Update README.md #59

Workflow file for this run

name: Static checks - misspell and shellcheck
on: push
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: egde-resource-mgr-'${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
static-checks:
runs-on: ubuntu-latest
env:
SUMMARY_FILE: summary.log
steps:
- name: Check out code
uses: actions/checkout@v3
# Need to run this 1st, so that the other log files do not cause unnecessary findings
# tox already runs pylint
- name: Run misspell
if: always()
run: |
# Remove the vendor folder - we don't need to check that.
rm -rf vendor
curl -L -o ./install-misspell.sh https://git.io/misspell
sh ./install-misspell.sh
bin/misspell -i mosquitto . >misspell.log
echo "### misspell" >>$SUMMARY_FILE
bin/misspell -error -i mosquitto .
lines=$(wc -l < "misspell.log")
if [[ $lines -gt 0 ]]; then
echo "Misspell has findings, fail."
echo "TEST_FAIL=true" >> $GITHUB_ENV
cat misspell.log >>$SUMMARY_FILE
exit 1
else
echo "No findings" >>$SUMMARY_FILE
fi
- name: Run shellcheck
if: always()
run: |
sudo apt-get update
sudo apt-get install shellcheck
shellcheck *.sh >shellcheck.log
echo "### shellcheck" >>$SUMMARY_FILE
lines=$(wc -l < "shellcheck.log")
if [[ $lines -gt 0 ]]; then
echo "Shellcheck has findings, fail."
echo "TEST_FAIL=true" >> $GITHUB_ENV
cat shellcheck.log >>$SUMMARY_FILE
exit 1
else
echo "No findings" >>$SUMMARY_FILE
fi
- name: Archive production artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: Upload findings logs
path: |
*.log
- name: Summary
if: always()
run: cat $SUMMARY_FILE >>$GITHUB_STEP_SUMMARY
- name: Set whole job status based on found fails
if: always()
run: |
if [ "$TEST_FAIL" = "true" ]; then
echo "Some test has failed, fail the job."
exit 1 # You can choose to exit with success (0) to mark this step as successful but skipped.
fi