Skip to content

Commit

Permalink
Extend CI build checks to cover manual pages.
Browse files Browse the repository at this point in the history
Configure an additional CI job to run some basic formatting and
style checks on the changes to the manual page.  As part of that,
address all the identified issues there so we could start with a
clean slate.

At the same time, make running ShellCheck dependent on changes to
the script itself, so it will not be run unless that is necessary.
  • Loading branch information
pgj committed Jan 8, 2025
1 parent d62f500 commit 315bb5d
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 81 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/man.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Manual page linter
on:
push:
paths:
- 'man/**'
- '.github/workflows/man.yml'

jobs:
Checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y igor
run: |
make VERSION=9.9.9 mancheck
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Build Checks
on: [push]
name: ShellCheck
on:
push:
paths:
- 'sbin/**'
- '.github/workflows/shellcheck.yml'

jobs:
checks:
Checks:
runs-on: ubuntu-latest
name: Sanity check CI job
steps:
- uses: actions/checkout@v4
- name: ShellCheck results
id: shellcheck
uses: vmactions/freebsd-vm@v1
- uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
Expand Down
18 changes: 17 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ GZIP=/usr/bin/gzip
GIT=$(LOCALBASE)/bin/git
SHELLCHECK=$(LOCALBASE)/bin/shellcheck
UNAME=/usr/bin/uname
IGOR=${LOCALBASE}/bin/igor
ASPELL=${LOCALBASE}/bin/aspell
MANDOC=/usr/bin/mandoc
ECHO=/bin/echo
TOUCH=/usr/bin/touch
RM=/bin/rm -f

.if !defined(VERSION)
VERSION!= $(GIT) describe --tags --always
Expand Down Expand Up @@ -61,6 +67,7 @@ SUB_LIST+= SUSPEND_CMD=/usr/bin/true \

_SUB_LIST_EXP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}
_SCRIPT_SRC= sbin/wifibox
_MAN_SRC= man/wifibox.8

install:
$(MKDIR) -p $(BINDIR)
Expand All @@ -80,7 +87,7 @@ install:
$(SED) ${_SUB_LIST_EXP} rc.d/wifibox > $(RCDIR)/wifibox
$(CHMOD) 555 $(RCDIR)/wifibox

$(SED) ${_SUB_LIST_EXP} man/wifibox.8 \
$(SED) ${_SUB_LIST_EXP} ${_MAN_SRC} \
| $(GZIP) -c > $(MANDIR)/man8/wifibox.8.gz
$(LN) -s ${_GUEST_MAN} $(MANDIR)/man5/wifibox-guest.5.gz

Expand All @@ -90,3 +97,12 @@ clean: ;

shellcheck:
@$(SHELLCHECK) -x ${_SCRIPT_SRC}

mancheck:
@${ECHO} mandoc -T lint
# Create a dummy manual page to suppress the `mandoc` warning
@${TOUCH} wifibox-guest.5
@$(SED) ${_SUB_LIST_EXP} ${_MAN_SRC} | ${MANDOC} -T lint
@${RM} wifibox-guest.5
@${ECHO} igor
@$(SED) ${_SUB_LIST_EXP} ${_MAN_SRC} | ${IGOR}
Loading

0 comments on commit 315bb5d

Please sign in to comment.