Skip to content

Commit d360cca

Browse files
committed
Run shellcheck in CI
1 parent 602a8a7 commit d360cca

File tree

5 files changed

+38
-10
lines changed

5 files changed

+38
-10
lines changed

.github/workflows/actionlint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: |
2222
# We want space splitting
2323
# shellcheck disable=SC2086
24-
for file in $(git ls-files .github/workflows/*)
24+
for file in $(git ls-files .github/workflows/*.yml)
2525
do
2626
echo "Checking $file"
2727
${{ steps.get_actionlint.outputs.executable }} -color $file || exit 1

.github/workflows/shellcheck-exceptions.txt

Whitespace-only changes.

.github/workflows/shellcheck.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: shellcheck
2+
# This pipeline runs shellcheck on all files with extension .sh,
3+
# except the ones listed in .github/workflows/shellcheck-exceptions.txt.
4+
5+
on:
6+
push:
7+
merge_group:
8+
pull_request:
9+
10+
jobs:
11+
shellcheck:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v5
15+
16+
- name: Shellcheck
17+
run: |
18+
for file in $(git ls-files "*.sh")
19+
do
20+
if grep -q "$file" ".github/workflows/shellcheck-exceptions.txt"
21+
then
22+
echo "⚠️ $file is ignored from shellcheck's verifications. Please consider fixing it."
23+
else
24+
echo "shellcheck \"$file\""
25+
shellcheck "$file"
26+
fi
27+
done

slides/build_java.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#!/usr/bin/env bash
2-
set -e
32
#
43
# Generate the .java files here, taking the snippets
54
# from the various *.md files as input
65

7-
for f in $(ls *.md | grep course)
6+
set -e
7+
8+
for f in course*.md
89
do
9-
f_java=$(echo $f | tr -d '-' | sed 's/\.md$/.java/')
10+
f_java=$(echo "$f" | tr -d '-' | sed 's/\.md$/.java/')
1011
f_java="${f_java^}" # Put first character uppercase
1112
rm -Rf "$f_java"
12-
exdown.py -f java $f > "$f_java" || exit 1
13+
exdown.py -f java "$f" > "$f_java" || exit 1
1314
done
1415

15-
javac *.java
16+
javac ./*.java
1617

1718
RC="$?"
1819

19-
rm -Rf *.class
20+
rm -Rf ./*.class
2021

2122
exit "$RC"

slides/extract_hs.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ set -e
77

88
EXDOWN="${EXDOWN:-exdown.py}"
99

10-
for f in $(ls *.md | grep course)
10+
for f in course*.md
1111
do
12-
hs_module_name=$(echo $f | tr -d '-' | sed 's/\.md$//')
12+
hs_module_name=$(echo "$f" | tr -d '-' | sed 's/\.md$//')
1313
hs_module_name=${hs_module_name^} # Put first character uppercase
1414
f_hs="${hs_module_name}.hs"
1515
rm -Rf "$f_hs"
1616
echo "$EXDOWN -f hs $f > $f_hs"
17-
$EXDOWN -f hs $f > "$f_hs" || exit 1 # exdown is https://github.com/smelc/exdown
17+
$EXDOWN -f hs "$f" > "$f_hs" || exit 1 # exdown is https://github.com/smelc/exdown
1818
echo "Written $f_hs"
1919
done

0 commit comments

Comments
 (0)