Skip to content

Commit

Permalink
Enable shellcheck and fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
colincasey committed Mar 20, 2024
1 parent 5a05878 commit feeea62
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ jobs:
uses: actions/checkout@v4
- name: Functional tests on heroku:${{ matrix.stack_number }}-build
run: test/run

shell-lint:
runs-on: ubuntu-22.04
container:
image: koalaman/shellcheck-alpine:v0.9.0
steps:
- uses: actions/checkout@v4
- name: shellcheck
run: shellcheck -x bin/compile bin/detect bin/release bin/report
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
test: heroku-22-build heroku-20-build

shellcheck:
@shellcheck -x bin/compile bin/detect bin/release bin/report

heroku-22-build:
@echo "Running tests in docker (heroku-22-build)..."
@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;'
Expand Down
6 changes: 3 additions & 3 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ else
# like>> :repo:deb http://cz.archive.ubuntu.com/ubuntu artful main universe
if grep -q -e "^:repo:" "$BUILD_DIR/Aptfile"; then
topic "Adding custom repositories"
cat "$BUILD_DIR/Aptfile" | grep -s -e "^:repo:" | sed 's/^:repo:\(.*\)\s*$/\1/g' >> "$APT_SOURCES"
grep -s -e "^:repo:" "$BUILD_DIR/Aptfile" | sed 's/^:repo:\(.*\)\s*$/\1/g' >> "$APT_SOURCES"
fi
fi

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

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

mkdir -p "$BUILD_DIR/.apt"

Expand Down

0 comments on commit feeea62

Please sign in to comment.