Skip to content

Commit 04db859

Browse files
committed
Enable shellcheck and fix warnings
1 parent 3c4b8c6 commit 04db859

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,12 @@ jobs:
2323
uses: actions/checkout@v4
2424
- name: Functional tests on heroku:${{ matrix.stack_number }}-build
2525
run: test/run
26+
27+
shell-lint:
28+
runs-on: ubuntu-22.04
29+
container:
30+
image: koalaman/shellcheck-alpine:v0.9.0
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: shellcheck
34+
run: shellcheck -x bin/compile bin/detect bin/release bin/report

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
test: heroku-22-build heroku-20-build
22

3+
shellcheck:
4+
@shellcheck -x bin/compile bin/detect bin/release bin/report
5+
36
heroku-22-build:
47
@echo "Running tests in docker (heroku-22-build)..."
58
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-22" heroku/heroku:22-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'

bin/compile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ else
6969
# like>> :repo:deb http://cz.archive.ubuntu.com/ubuntu artful main universe
7070
if grep -q -e "^:repo:" "$BUILD_DIR/Aptfile"; then
7171
topic "Adding custom repositories"
72-
cat "$BUILD_DIR/Aptfile" | grep -s -e "^:repo:" | sed 's/^:repo:\(.*\)\s*$/\1/g' >> "$APT_SOURCES"
72+
grep -s -e "^:repo:" "$BUILD_DIR/Aptfile" | sed 's/^:repo:\(.*\)\s*$/\1/g' >> "$APT_SOURCES"
7373
fi
7474
fi
7575

@@ -80,7 +80,7 @@ APT_OPTIONS+=("-o" "dir::etc::sourcelist=$APT_SOURCES" "-o" "dir::etc::sourcepar
8080
topic "Updating apt caches"
8181
apt-get "${APT_OPTIONS[@]}" update 2>&1 | indent
8282

83-
for PACKAGE in $(cat "$BUILD_DIR/Aptfile" | grep -v -s -e '^#' | grep -v -s -e "^:repo:"); do
83+
while IFS= read -r PACKAGE; do
8484
if [[ $PACKAGE == *deb ]]; then
8585
PACKAGE_NAME=$(basename "$PACKAGE" .deb)
8686
PACKAGE_FILE=$APT_CACHE_DIR/archives/$PACKAGE_NAME.deb
@@ -91,7 +91,7 @@ for PACKAGE in $(cat "$BUILD_DIR/Aptfile" | grep -v -s -e '^#' | grep -v -s -e "
9191
topic "Fetching .debs for $PACKAGE"
9292
apt-get "${APT_OPTIONS[@]}" -y "${APT_FORCE_YES[@]}" -d install --reinstall "$PACKAGE" | indent
9393
fi
94-
done
94+
done < <(grep --invert-match -e "^#" -e "^\s*$" -e "^:repo:" "${BUILD_DIR}/Aptfile")
9595

9696
mkdir -p "$BUILD_DIR/.apt"
9797

0 commit comments

Comments
 (0)