1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 16:49:41 +00:00

Complete automated testing

This commit is contained in:
Tw93
2025-10-12 15:43:45 +08:00
parent f9a93f6052
commit 3c56fe0633
13 changed files with 484 additions and 198 deletions

45
.github/workflows/shell-format.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Shell Format & Lint
on:
push:
branches: [main]
paths:
- '**/*.sh'
- mole
pull_request:
paths:
- '**/*.sh'
- mole
jobs:
format-lint:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install shfmt and shellcheck
run: brew install shfmt shellcheck
- name: Run shfmt in diff mode
run: |
set -euo pipefail
mapfile -d '' files < <(find . -type f \( -name '*.sh' -o -name 'mole' \) \
! -path './.git/*' ! -path './tests/tmp-*' -print0)
if (( ${#files[@]} == 0 )); then
echo "No shell files found; skipping shfmt"
exit 0
fi
shfmt -i 4 -ci -sr -d "${files[@]}"
- name: Run shellcheck
run: |
set -euo pipefail
mapfile -d '' files < <(find . -type f \( -name '*.sh' -o -name 'mole' \) \
! -path './.git/*' ! -path './tests/tmp-*' -print0)
if (( ${#files[@]} == 0 )); then
echo "No shell files found; skipping shellcheck"
exit 0
fi
shellcheck --rcfile .shellcheckrc "${files[@]}"