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
35 changes: 32 additions & 3 deletions .github/scripts/test-link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,38 @@ else
exit 1
fi

# Test symbolic link creation (in safe mode)
export DRY_RUN=true
./link.sh || true
# Test symbolic link creation (actual execution)
echo "Creating temporary HOME for testing..."
export TEST_HOME=$(mktemp -d)
export HOME="$TEST_HOME"
echo "Using temporary HOME: $TEST_HOME"

echo "Executing link.sh in test environment..."
./link.sh

echo "Verifying symbolic links were created..."
links_created=0
while IFS=':' read -r source target; do
# Expand ~ in target path
expanded_target=$(eval echo "$target")
if [ -L "$expanded_target" ]; then
echo "✓ Symbolic link created: $expanded_target -> $(readlink "$expanded_target")"
links_created=$((links_created + 1))
else
echo "✗ Symbolic link not created: $expanded_target"
fi
done <<< "$(grep -E '^\s*"[^"]+:[^"]+"\s*$' link.sh | sed 's/[" ]//g')"

if [ $links_created -gt 0 ]; then
echo "✓ Successfully created $links_created symbolic links"
else
echo "✗ No symbolic links were created"
exit 1
fi

# Cleanup test environment
echo "Cleaning up test environment..."
rm -rf "$TEST_HOME"

# Verify all source files exist
echo "Verifying source files exist..."
Expand Down
60 changes: 60 additions & 0 deletions .github/scripts/test-settings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

set -e

echo "Testing settings.sh..."

# Check if script is executable
if test -x ./settings.sh; then
echo "✓ settings.sh is executable"
else
echo "✗ settings.sh is not executable"
exit 1
fi

# Validate script syntax
if bash -n ./settings.sh; then
echo "✓ settings.sh syntax is valid"
else
echo "✗ settings.sh has syntax errors"
exit 1
fi

# Check for required macOS commands
echo "Checking for required macOS commands..."
commands=(
"defaults"
)

for cmd in "${commands[@]}"; do
if command -v "$cmd" >/dev/null 2>&1; then
echo "✓ Command '$cmd' is available"
else
echo "✗ Command '$cmd' is not available"
exit 1
fi
done

# Check for proper shebang
if head -n 1 settings.sh | grep -q "#!/bin/bash"; then
echo "✓ settings.sh has proper shebang"
else
echo "✗ settings.sh missing or incorrect shebang"
exit 1
fi

# Execute settings.sh to test actual functionality
echo "Executing settings.sh..."
./settings.sh

# Verify the settings were applied correctly
echo "Verifying ApplePressAndHoldEnabled setting..."
press_hold_setting=$(defaults read -g ApplePressAndHoldEnabled 2>/dev/null || echo "not set")
if [ "$press_hold_setting" = "0" ]; then
echo "✓ ApplePressAndHoldEnabled is correctly set to false"
else
echo "✗ ApplePressAndHoldEnabled setting verification failed (value: $press_hold_setting)"
exit 1
fi

echo "✓ settings.sh test completed successfully"
5 changes: 5 additions & 0 deletions .github/workflows/test-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- "Brewfile"
- "install.sh"
- "link.sh"
- "settings.sh"
pull_request:
branches: [ main ]
paths:
Expand All @@ -21,6 +22,7 @@ on:
- "Brewfile"
- "install.sh"
- "link.sh"
- "settings.sh"

jobs:
test-macos:
Expand All @@ -45,6 +47,9 @@ jobs:
- name: Test Brewfile
run: ./.github/scripts/test-brewfile.sh

- name: Test settings.sh
run: ./.github/scripts/test-settings.sh

- name: Cleanup
if: always()
run: ./.github/scripts/cleanup-environment.sh
1 change: 1 addition & 0 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ brew "tmux"
brew "codex"
cask "ghostty"
cask "cursor"
cask "font-hack-nerd-font"
11 changes: 11 additions & 0 deletions settings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# macOS System Settings Configuration

echo "Configuring macOS system settings..."

# Disable press-and-hold for keys in favor of key repeat
# This allows holding down a key to repeat it instead of showing accent menu
defaults write -g ApplePressAndHoldEnabled -bool false

echo "macOS settings applied. Please restart your system for all changes to take effect."