44 push :
55 branches : [master, develop, laravel-12]
66 paths :
7- - ' new_install.sh'
8- - ' uninstall-spikster.sh'
9- - ' go.sh'
10- - ' multipass/**'
11- - ' .github/workflows/test-multipass.yml'
7+ - " new_install.sh"
8+ - " uninstall-spikster.sh"
9+ - " go.sh"
10+ - " multipass/**"
11+ - " .github/workflows/test-multipass.yml"
1212 pull_request :
1313 branches : [master, develop]
1414 paths :
15- - ' new_install.sh'
16- - ' uninstall-spikster.sh'
15+ - " new_install.sh"
16+ - " uninstall-spikster.sh"
1717 workflow_dispatch :
1818 inputs :
1919 ubuntu_version :
20- description : ' Ubuntu version to test'
20+ description : " Ubuntu version to test"
2121 required : false
22- default : ' 24.04'
22+ default : " 24.04"
2323 type : choice
2424 options :
25- - ' 20.04'
26- - ' 22.04'
27- - ' 24.04'
25+ - " 20.04"
26+ - " 22.04"
27+ - " 24.04"
2828 branch :
29- description : ' Branch to install'
29+ description : " Branch to install"
3030 required : false
31- default : ' master'
31+ default : " master"
3232
3333jobs :
3434 test-installation :
3535 name : Test on Ubuntu ${{ matrix.ubuntu }}
3636 runs-on : macos-latest
3737 timeout-minutes : 30
38-
38+
3939 strategy :
4040 fail-fast : false
4141 matrix :
42- ubuntu : [' 20.04', ' 22.04', ' 24.04' ]
43-
42+ ubuntu : [" 20.04", " 22.04", " 24.04" ]
43+
4444 steps :
4545 - name : Checkout code
4646 uses : actions/checkout@v4
47-
47+
4848 - name : Install Multipass
4949 run : |
5050 echo "Installing Multipass..."
5151 brew install multipass
5252 multipass version
53-
53+
5454 - name : Wait for Multipass daemon
5555 run : |
5656 echo "Waiting for Multipass daemon to be ready..."
5757 sleep 10
5858 multipass list || true
59-
59+
6060 - name : Launch Ubuntu VM
6161 id : launch-vm
6262 run : |
6363 VM_NAME="test-${{ matrix.ubuntu }}-${{ github.run_id }}"
6464 echo "vm_name=$VM_NAME" >> $GITHUB_OUTPUT
65-
65+
6666 echo "Launching Ubuntu ${{ matrix.ubuntu }} VM: $VM_NAME"
6767 multipass launch ${{ matrix.ubuntu }} \
6868 --name "$VM_NAME" \
6969 --cpus 2 \
7070 --memory 4G \
7171 --disk 20G \
7272 --timeout 600
73-
73+
7474 echo "VM launched successfully"
7575 multipass info "$VM_NAME"
76-
76+
7777 - name : Transfer installation script
7878 run : |
7979 echo "Transferring new_install.sh to VM..."
8080 multipass transfer new_install.sh ${{ steps.launch-vm.outputs.vm_name }}:/tmp/
81-
81+
8282 - name : Run Spikster installation
8383 id : install
8484 run : |
8585 echo "Running Spikster installation..."
8686 VM_NAME="${{ steps.launch-vm.outputs.vm_name }}"
8787 BRANCH="${{ github.event.inputs.branch || 'master' }}"
88-
88+
8989 # Run installation and capture output
9090 multipass exec "$VM_NAME" -- sudo bash /tmp/new_install.sh -b "$BRANCH" || {
9191 echo "Installation failed!"
9292 exit 1
9393 }
94-
94+
9595 - name : Get VM IP
9696 id : get-ip
9797 run : |
9898 VM_NAME="${{ steps.launch-vm.outputs.vm_name }}"
9999 IP=$(multipass info "$VM_NAME" | grep IPv4 | awk '{print $2}')
100100 echo "vm_ip=$IP" >> $GITHUB_OUTPUT
101101 echo "VM IP: $IP"
102-
102+
103103 - name : Wait for services
104104 run : |
105105 echo "Waiting 60 seconds for services to fully start..."
106106 sleep 60
107-
107+
108108 - name : Test HTTP response
109109 run : |
110110 IP="${{ steps.get-ip.outputs.vm_ip }}"
111111 echo "Testing HTTP response from $IP..."
112-
112+
113113 # Retry up to 5 times
114114 for i in {1..5}; do
115115 HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "http://$IP" || echo "000")
116116 echo "Attempt $i: HTTP $HTTP_CODE"
117-
117+
118118 if [ "$HTTP_CODE" = "200" ]; then
119119 echo "✅ HTTP test PASSED"
120120 exit 0
121121 fi
122-
122+
123123 if [ $i -lt 5 ]; then
124124 echo "Retrying in 10 seconds..."
125125 sleep 10
126126 fi
127127 done
128-
128+
129129 echo "⚠️ HTTP test did not return 200 OK"
130130 exit 1
131-
131+
132132 - name : Check services status
133133 if : always()
134134 run : |
135135 VM_NAME="${{ steps.launch-vm.outputs.vm_name }}"
136136 echo "Checking service status..."
137-
137+
138138 echo "=== Nginx ==="
139139 multipass exec "$VM_NAME" -- systemctl status nginx --no-pager || true
140-
140+
141141 echo "=== PHP-FPM ==="
142142 multipass exec "$VM_NAME" -- systemctl status php8.3-fpm --no-pager || true
143-
143+
144144 echo "=== MySQL ==="
145145 multipass exec "$VM_NAME" -- systemctl status mysql --no-pager || true
146-
146+
147147 echo "=== Redis ==="
148148 multipass exec "$VM_NAME" -- systemctl status redis-server --no-pager || true
149-
149+
150150 echo "=== Supervisor ==="
151151 multipass exec "$VM_NAME" -- systemctl status supervisor --no-pager || true
152-
152+
153153 - name : Check disk usage
154154 if : always()
155155 run : |
156156 VM_NAME="${{ steps.launch-vm.outputs.vm_name }}"
157157 echo "Disk usage:"
158158 multipass exec "$VM_NAME" -- df -h /
159-
159+
160160 - name : Retrieve installation log
161161 if : always()
162162 run : |
163163 VM_NAME="${{ steps.launch-vm.outputs.vm_name }}"
164164 echo "=== Last 100 lines of installation log ==="
165165 multipass exec "$VM_NAME" -- sudo tail -n 100 /var/log/spikster_install.log || echo "Log file not found"
166-
166+
167167 - name : Save installation log
168168 if : always()
169169 run : |
170170 VM_NAME="${{ steps.launch-vm.outputs.vm_name }}"
171171 mkdir -p logs
172172 multipass exec "$VM_NAME" -- sudo cat /var/log/spikster_install.log > logs/install-${{ matrix.ubuntu }}.log 2>/dev/null || true
173-
173+
174174 - name : Upload installation logs
175175 if : always()
176176 uses : actions/upload-artifact@v4
177177 with :
178178 name : installation-logs-ubuntu-${{ matrix.ubuntu }}
179179 path : logs/*.log
180180 retention-days : 30
181-
181+
182182 - name : Cleanup VM
183183 if : always()
184184 run : |
185185 VM_NAME="${{ steps.launch-vm.outputs.vm_name }}"
186186 echo "Cleaning up VM: $VM_NAME"
187187 multipass delete "$VM_NAME" || true
188188 multipass purge || true
189-
189+
190190 - name : Test summary
191191 if : always()
192192 run : |
@@ -196,19 +196,19 @@ jobs:
196196 echo "VM Name: ${{ steps.launch-vm.outputs.vm_name }}"
197197 echo "VM IP: ${{ steps.get-ip.outputs.vm_ip }}"
198198 echo "Status: ${{ job.status }}"
199-
199+
200200 test-summary :
201201 name : Test Summary
202202 runs-on : ubuntu-latest
203203 needs : test-installation
204204 if : always()
205-
205+
206206 steps :
207207 - name : Check test results
208208 run : |
209209 echo "=== All Tests Complete ==="
210210 echo "Check individual job results above"
211-
211+
212212 if [ "${{ needs.test-installation.result }}" = "success" ]; then
213213 echo "✅ All installation tests passed!"
214214 exit 0
0 commit comments