Skip to content

Commit

Permalink
Sync with latest boilerplate.
Browse files Browse the repository at this point in the history
* CI: Update GitHub Action versions.
* QA: Add shellcheck and fix/ignore all issues.
* install.sh: slightly better feedback for setup commands.
* install.sh: fix quoting bug in do_config_backup.
* install.sh: don't output printf commands.
  • Loading branch information
Gadgetoid committed Jan 10, 2024
1 parent 00224ee commit d6ae4aa
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 88 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand All @@ -35,7 +35,7 @@ jobs:
make build
- name: Upload Packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_FILE }}
path: dist/
9 changes: 6 additions & 3 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ jobs:
test:
name: linting & spelling
runs-on: ubuntu-latest

env:
TERM: xterm-256color

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python '3,11'
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.11'

Expand All @@ -34,3 +33,7 @@ jobs:
- name: Run Code Checks
run: |
make check
- name: Run Bash Code Checks
run: |
make shellcheck
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ uninstall:

dev-deps:
python3 -m pip install -r requirements-dev.txt
sudo apt install dos2unix
sudo apt install dos2unix shellcheck

check:
@bash check.sh

shellcheck:
shellcheck *.sh

qa:
tox -e qa

Expand Down
20 changes: 8 additions & 12 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# This script handles some basic QA checks on the source

NOPOST=$1
LIBRARY_NAME=`hatch project metadata name`
LIBRARY_VERSION=`hatch version | awk -F "." '{print $1"."$2"."$3}'`
POST_VERSION=`hatch version | awk -F "." '{print substr($4,0,length($4))}'`
LIBRARY_NAME=$(hatch project metadata name)
LIBRARY_VERSION=$(hatch version | awk -F "." '{print $1"."$2"."$3}')
POST_VERSION=$(hatch version | awk -F "." '{print substr($4,0,length($4))}')
TERM=${TERM:="xterm-256color"}

success() {
Expand All @@ -29,7 +29,7 @@ while [[ $# -gt 0 ]]; do
;;
*)
if [[ $1 == -* ]]; then
printf "Unrecognised option: $1\n";
printf "Unrecognised option: %s\n" "$1";
exit 1
fi
POSITIONAL_ARGS+=("$1")
Expand All @@ -40,8 +40,7 @@ done
inform "Checking $LIBRARY_NAME $LIBRARY_VERSION\n"

inform "Checking for trailing whitespace..."
grep -IUrn --color "[[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
if [[ $? -eq 0 ]]; then
if grep -IUrn --color "[[:blank:]]$" --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO; then
warning "Trailing whitespace found!"
exit 1
else
Expand All @@ -50,8 +49,7 @@ fi
printf "\n"

inform "Checking for DOS line-endings..."
grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
if [[ $? -eq 0 ]]; then
if grep -lIUrn --color $'\r' --exclude-dir=dist --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile; then
warning "DOS line-endings found!"
exit 1
else
Expand All @@ -60,8 +58,7 @@ fi
printf "\n"

inform "Checking CHANGELOG.md..."
cat CHANGELOG.md | grep ^${LIBRARY_VERSION} > /dev/null 2>&1
if [[ $? -eq 1 ]]; then
if ! grep "^${LIBRARY_VERSION}" CHANGELOG.md > /dev/null 2>&1; then
warning "Changes missing for version ${LIBRARY_VERSION}! Please update CHANGELOG.md."
exit 1
else
Expand All @@ -70,8 +67,7 @@ fi
printf "\n"

inform "Checking for git tag ${LIBRARY_VERSION}..."
git tag -l | grep -E "${LIBRARY_VERSION}$"
if [[ $? -eq 1 ]]; then
if ! git tag -l | grep -E "${LIBRARY_VERSION}$"; then
warning "Missing git tag for version ${LIBRARY_VERSION}"
fi
printf "\n"
Expand Down

0 comments on commit d6ae4aa

Please sign in to comment.