-
Notifications
You must be signed in to change notification settings - Fork 7
149 lines (115 loc) · 4.93 KB
/
Copy pathtest-sjust.yml
File metadata and controls
149 lines (115 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: Test Sjust Installation
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:
jobs:
test-sjust:
runs-on: macos-15
env:
TERM: xterm-256color
SHELL: /bin/zsh
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup sparkdock directory
run: |
echo "Creating /opt/sparkdock directory and copying files..."
sudo mkdir -p /opt/sparkdock
sudo cp -R . /opt/sparkdock/
sudo chown -R $(whoami):staff /opt/sparkdock
echo "Verifying sparkdock directory structure..."
ls -la /opt/sparkdock/sjust/
- name: Install Just command runner
run: |
echo "Installing Just command runner..."
brew install just
- name: Test sjust library files syntax
run: |
echo "Testing libcolors.sh syntax..."
/bin/zsh -n sjust/libs/libcolors.sh
echo "Testing libformatting.sh syntax..."
/bin/zsh -n sjust/libs/libformatting.sh
echo "Testing sjust.sh syntax..."
/bin/zsh -n sjust/sjust.sh
- name: Test Just recipe files syntax
run: |
echo "Testing main justfile syntax..."
just --justfile sjust/justfile --dry-run --list > /dev/null
echo "Testing individual recipe files..."
just --justfile sjust/recipes/00-default.just --dry-run --list > /dev/null
just --justfile sjust/recipes/01-lima.just --dry-run --list > /dev/null
- name: Test make install-sjust with git check disabled
run: |
echo "Testing make install-sjust command..."
cd /opt/sparkdock
# Run install-sjust with git check disabled
SKIP_GIT_CHECK=1 make install-sjust
echo "Testing sjust command is available..."
which sjust
echo "Testing sjust can list commands without errors..."
sjust --list
- name: Test zsh completion generation
run: |
echo "Testing zsh completion for sjust..."
# Check if completion file was created
BREW_PREFIX=$(brew --prefix 2>/dev/null || echo "/usr/local")
COMPLETION_FILE="$BREW_PREFIX/share/zsh/site-functions/_sjust"
if [ -f "$COMPLETION_FILE" ]; then
echo "✅ Completion file created at: $COMPLETION_FILE"
echo "Checking completion file content..."
head -5 "$COMPLETION_FILE"
# Verify it contains sjust references instead of just
if grep -q "sjust" "$COMPLETION_FILE"; then
echo "✅ Completion file correctly references 'sjust'"
else
echo "❌ Completion file does not contain 'sjust' references"
exit 1
fi
else
echo "❌ Completion file not found at: $COMPLETION_FILE"
exit 1
fi
- name: Test library functions can be sourced
run: |
echo "Testing that library files can be sourced without errors..."
# Test sourcing libcolors.sh
/bin/zsh -c "source sjust/libs/libcolors.sh && echo 'libcolors.sh sourced successfully'"
# Test sourcing libformatting.sh
/bin/zsh -c "source sjust/libs/libformatting.sh && echo 'libformatting.sh sourced successfully'"
# Test that functions are available after sourcing
/bin/zsh -c "source sjust/libs/libformatting.sh && echo 'Testing Urllink function:' && Urllink 'https://example.com' 'Example Link'"
- name: Test specific sjust commands (dry-run mode)
run: |
echo "Testing specific sjust commands in dry-run mode..."
# Test that device-info command can be parsed (dry-run)
sjust --dry-run device-info
# Test that docker-ps command can be parsed (dry-run)
sjust --dry-run docker-ps
# Test that upgrade-system command can be parsed (dry-run)
sjust --dry-run upgrade-system
- name: Test sjust with non-interactive environment
env:
NON_INTERACTIVE: "true"
run: |
echo "Testing sjust works in non-interactive environment..."
sjust --list > /dev/null
echo "✅ Sjust works correctly in non-interactive mode"
- name: Test sjust recipe imports
run: |
echo "Testing that recipe imports work correctly..."
# Verify that the main justfile can import all recipes
just --justfile sjust/justfile --evaluate > /dev/null
echo "✅ All recipe imports work correctly"
- name: Clean up test installations
if: always()
run: |
echo "Cleaning up..."
sudo rm -f /usr/local/bin/sjust
# Clean up completion file
BREW_PREFIX=$(brew --prefix 2>/dev/null || echo "/usr/local")
sudo rm -f "$BREW_PREFIX/share/zsh/site-functions/_sjust"
# Clean up sparkdock directory
sudo rm -rf /opt/sparkdock