Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions .github/workflows/bashisms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@ permissions:
contents: read

on:
push:
branches:
- main
- dev
paths:
- "**/*.sh"
pull_request:
branches:
- main
- dev
paths:
- "*.sh"
merge_group:
- "**/*.sh"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
bashisms:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release

on:
push:
pull_request:
branches:
- main
paths-ignore:
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/shellchesk.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
name: Script Checks

permissions:
contents: read

on:
push:
branches:
- main
- dev
paths:
- "**/*.sh"
pull_request:
branches:
- main
- dev
paths:
- "**/*.sh"
workflow_dispatch:

permissions:
contents: read
pull-requests: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
shellcheck:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
name: Test

permissions:
contents: read

on:
push:
branches:
- main
- dev
paths-ignore:
- "README.md"
- ".gitignore"
- ".github/**"
pull_request:
branches:
- main
- dev
paths-ignore:
- "README.md"
- ".gitignore"
- ".github/**"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
install:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
installation.log
.config/zsh/plugins/
logging/
3 changes: 2 additions & 1 deletion .stow-local-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
setup.sh
LICENSE
README.md
installation.log
installation.log
makefile
1 change: 1 addition & 0 deletions .vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set number
58 changes: 58 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.PHONY: all bashism shellcheck typos

ROOT_DIR = .
LOG_DIR = logging
OUTPUT_PATH = $(ROOT_DIR)/$(LOG_DIR)
OUTPUT_OUT = $(OUTPUT_PATH)/$(PHASE).out
OUTPUT_ERR = $(OUTPUT_PATH)/$(PHASE).err
OUTPUT = 1>$(OUTPUT_OUT) 2>$(OUTPUT_ERR)

SHELL_SCRIPTS := $(shell find $(ROOT_DIR) -type f -name '*.sh' \
-not -path '*/.git/*' \
-not -path '*/.config/*')

all: bashism shellchek typos ## Do all checks

help: ## Show this help.
@grep -E -h '\s##\s' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}'\

$(OUTPUT_PATH):
@mkdir -p $(OUTPUT_PATH)

bashism: PHASE = bashism ## Check for bashism
bashism: $(OUTPUT_PATH)
@echo "***Checking for bashism..."
@fail=0; \
for file in $(SHELL_SCRIPTS); do \
out=$$(checkbashisms "$$file" 2>&1); \
status=$$?; \
if [[ $$status -ne 0 && $$status -ne 4 ]]; then \
echo "$$out" >> $(OUTPUT_ERR); \
fail=1; \
else \
echo "$$out" >> $(OUTPUT_OUT); \
fi; \
done; \
if [ $$fail -ne 0 ]; then \
echo "bashism check failed, see $(OUTPUT_ERR)"; \
fi

shellchek: PHASE = shellchek ## Check for shell issues
shellchek: $(OUTPUT_PATH)
@echo "***Checking for shell issues..."
@shellcheck $(SHELL_SCRIPTS) $(OUTPUT); \
status=$$?; \
if [ $$status -ne 0 ]; then \
echo "shellcheck failed, see $(OUTPUT_ERR)"; \
exit $$status; \
fi

typos: PHASE = typos ## Check for typos
typos: $(OUTPUT_PATH)
@echo "***Checking for typos..."
@typos $(ROOT_DIR) $(OUTPUT); \
status=$$?; \
if [ $$status -ne 0 ]; then \
echo "typos check failed, see $(OUTPUT_ERR)"; \
exit $$status; \
fi
6 changes: 6 additions & 0 deletions scripts/setup-zsh-conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ setup_zsh_conf() {
printf "%snano configuration file backup in ~/.nanorc.bak%s\n" "${GREEN}" "${RC}"
fi

# Check if ~/.vimrc exists
if [ -f "$HOME/.vimrc" ]; then
mv "$HOME/.vimrc" "$HOME/.vimrc.bak"
printf "%svim configuration file backup in ~/.vimrc.bak%s\n" "${GREEN}" "${RC}"
fi

# Do stow dry run first to check for conflicts
printf "$(msg_warn "Checking for potential stow conflicts...")"

Expand Down