Merge pull request #3281 from AllskyTeam/Bug-fix-signal-handling-in-c… #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
push: | |
paths: | |
- '*.sh' | |
- '*/*.sh' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
# Runs a set of commands using the runners shell | |
- name: check bash files | |
run: | | |
# check bash files (bash -n, shellchecki -x) | |
err=0 | |
for i in $(find . -maxdepth 2 -name '*.sh'); do | |
echo "==================== $i" | |
bash -n $i | |
if [ $? -ne 0 ]; then | |
echo "bash found problem with $i" | |
err=$((err + 1)) | |
fi | |
this_err=0 | |
case $i in | |
###### Do not ignore these | |
#SC2034: ON_TTY appears unused. Verify use (or export if used externally). | |
#SC2206: Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. | |
#SC2207: Prefer mapfile or read -a to split command output (or quote to avoid splitting). | |
#SC2046: Quote this to prevent word splitting. | |
#SC2086: Double quote to prevent globbing and word splitting. | |
#SC2012: Use find instead of ls to better handle non-alphanumeric filenames. | |
#SC2016: Expressions don't expand in single quotes, use double quotes for that. | |
#SC2044: For loops over find output are fragile. Use find -exec or a while read loop. | |
#SC2196: egrep is non-standard and deprecated. Use grep -E instead. | |
*) | |
#SC1090: Can't follow non-constant source. Use a directive to specify location. | |
#SC1091: Similar to SC1090 | |
#SC2004: $/${} is unnecessary on arithmetic variables. | |
#SC2155: Declare and assign separately to avoid masking return values. | |
#SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. | |
#SC2188: This redirection doesn't have a command. Move to its command (or use 'true' as no-op). | |
#SC2069: Something about the order of >&2 and > xxx | |
#SC2024: similar to SC2069 | |
#SC2269: This variable is assigned to itself | |
###shellcheck -x -e SC1090 -e SC1091 -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 $i || this_err=1 | |
shellcheck -x -e SC2004 -e SC2155 -e SC2181 -e SC2188 -e SC2024 -e SC2069 -e SC2269 $i || this_err=1 | |
;; | |
esac | |
if [ ${this_err} -eq 1 ]; then | |
err=$((err + 1)) | |
fi | |
done | |
if [ $err -ne 0 ]; then | |
echo | |
echo "bash and/or shellcheck found problems in scripts. Please fix it or add some excludes (-e SC....) here in this file." | |
echo | |
fi | |
exit $err |