Skip to content

Commit e0e2d22

Browse files
committed
ci: test on OpenBSD with vmactions
Run the mutt-wizard test suite inside an OpenBSD 7.x VM. Also make the group/world-readable check portable: stat(1) uses -c on GNU and -f on BSD, so read the mode from ls(1) instead.
1 parent 8a5e383 commit e0e2d22

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

‎.github/workflows/openbsd.yml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: OpenBSD
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 30
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Test on OpenBSD
20+
uses: vmactions/openbsd-vm@v1
21+
with:
22+
# Newest OpenBSD 7.x; the action defaults to 7.9.
23+
release: "7"
24+
sync: rsync
25+
copyback: false
26+
prepare: |
27+
uname -a
28+
run: |
29+
set -eu
30+
31+
echo "== environment =="
32+
uname -a
33+
id
34+
make --version 2>&1 | head -n 1 || true
35+
36+
echo "== test suite =="
37+
make test

‎tests/run_tests.sh‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,15 @@ expect "header cache directory created" test -d "$H1/.cache/mutt-wizard/user_exa
286286
expect "notmuch config created" test -f "$H1/.notmuch-config"
287287
expect "imapnotify config created" test -f "$H1/.config/imapnotify/user@example.com.yaml"
288288
expect "urlview config created" test -f "$H1/.urlview"
289-
expect "config files are not group/world readable" sh -c 'stat -c "%a" "$1" | grep -qE "^[67]00$"' x "$MUTTRC"
289+
# Portable permission check: stat(1) flags differ between GNU (-c) and
290+
# BSD (-f), so inspect the mode field from ls(1) instead.
291+
expect "config files are not group/world readable" sh -c '
292+
mode=$(ls -l "$1" | cut -c1-10)
293+
case "$mode" in
294+
-rw------- | -rwx------) exit 0 ;;
295+
*) exit 1 ;;
296+
esac
297+
' x "$MUTTRC"
290298

291299
mw "$H1" -l >"$TMP/cap.out" 2>/dev/null
292300
expect "mw lists the added account" grep -q user@example.com "$TMP/cap.out"

0 commit comments

Comments
 (0)