Skip to content

Self-improving AI Employees for everyone

refactor: Separate CI and user install tests

trohitg1fa6f5222333
diff --git a/.github/workflows/predeploy.yml b/.github/workflows/predeploy.yml
index 6c3d3287..e091d731 100644
--- a/.github/workflows/predeploy.yml
+++ b/.github/workflows/predeploy.yml
@@ -1,5 +1,5 @@
# Reusable validation workflow called by ci.yml, release.yml, and docker-build.yml
-# Jobs: build-and-lint, docker-build, docker-compose-test, test-install (cross-platform)
+# Jobs: build-and-lint, docker-build, docker-compose-test, test-build-start
name: Predeploy
@@ -116,37 +116,8 @@ jobs:
if: always()
run: docker compose -f docker-compose.prod.yml down -v
- # Build client once on Ubuntu, upload as artifact for test-install jobs
- build-client:
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Setup environment
- uses: ./.github/actions/setup
-
- - name: Install and build client
- run: |
- cd client
- npm install
- npm run build
-
- - name: Pack npm package with pre-built client
- env:
- CI: false
- GITHUB_ACTIONS: false
- run: npm pack
-
- - name: Upload package artifact
- uses: actions/upload-artifact@v4
- with:
- name: npm-package
- path: machinaos-*.tgz
- retention-days: 1
-
- test-install:
- needs: build-client
+ # Test build and start from source (cross-platform)
+ test-build-start:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -159,54 +130,23 @@ jobs:
- name: Setup environment
uses: ./.github/actions/setup
- - name: Download package artifact
- uses: actions/download-artifact@v4
- with:
- name: npm-package
-
- - name: Test global install
- shell: bash
- env:
- CI: false
- GITHUB_ACTIONS: false
- run: |
- npm install -g machinaos-*.tgz
- machinaos --help
- machinaos --version
-
- - name: Setup Python venv only
- shell: bash
- run: |
- INSTALL_PATH=$(npm root -g)/machinaos
- cd "$INSTALL_PATH/server"
- uv venv
- uv sync
+ - name: Build
+ run: npm run build
- name: Verify build artifacts
shell: bash
run: |
- INSTALL_PATH=$(npm root -g)/machinaos
- echo "Installed to: $INSTALL_PATH"
-
- # Check essential files exist
- test -d "$INSTALL_PATH/client/dist" && echo "client/dist/ exists" || (echo "client/dist/ missing" && exit 1)
- test -d "$INSTALL_PATH/server/.venv" && echo "server/.venv/ created" || (echo "server/.venv/ missing" && exit 1)
+ test -d "client/dist" && echo "client/dist/ exists" || (echo "client/dist/ missing" && exit 1)
+ test -d "server/.venv" && echo "server/.venv/ exists" || (echo "server/.venv/ missing" && exit 1)
+ test -d "node_modules/whatsapp-rpc/bin" && echo "whatsapp-rpc/bin/ exists" || (echo "whatsapp-rpc/bin/ missing" && exit 1)
- # Verify Python venv is functional
- if [[ "$RUNNER_OS" == "Windows" ]]; then
- "$INSTALL_PATH/server/.venv/Scripts/python" --version
- else
- "$INSTALL_PATH/server/.venv/bin/python" --version
- fi
-
- - name: Test machinaos start (Unix)
+ - name: Test start (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
- machinaos start &
+ npm run start &
PID=$!
- # Wait for services to start
for i in {1..15}; do
if curl -sf http://localhost:3010/health > /dev/null 2>&1; then
echo "Backend healthy after $((i*2))s"
@@ -216,33 +156,36 @@ jobs:
done
if kill -0 $PID 2>/dev/null; then
- echo "machinaos start: OK - process running"
- machinaos stop || kill $PID 2>/dev/null || true
+ echo "npm run start: OK"
+ npm run stop || kill $PID 2>/dev/null || true
else
- echo "machinaos start: FAILED - process exited"
+ echo "npm run start: FAILED"
exit 1
fi
- - name: Test machinaos start (Windows)
+ - name: Test start (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
- $job = Start-Job -ScriptBlock { machinaos start }
+ $job = Start-Job -ScriptBlock {
+ Set-Location $using:PWD
+ npm run start
+ }
Start-Sleep -Seconds 15
try {
$response = Invoke-WebRequest -Uri "http://localhost:3010/health" -UseBasicParsing -TimeoutSec 5
Write-Host "Backend healthy: $($response.StatusCode)"
} catch {
- Write-Host "Backend not responding (may still be starting)"
+ Write-Host "Backend not responding"
}
if ($job.State -eq "Running") {
- Write-Host "machinaos start: OK - process running"
+ Write-Host "npm run start: OK"
Stop-Job $job
Remove-Job $job
} else {
- Write-Host "machinaos start: FAILED - job state: $($job.State)"
+ Write-Host "npm run start: FAILED"
Receive-Job $job
exit 1
- }
+ fi
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 694edf0a..2e7a27f0 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,4 +1,4 @@
-# Release workflow - predeploy gate then publish
+# Release workflow - predeploy gate, publish, then test install
name: Release
@@ -114,3 +114,8 @@ jobs:
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ # Test user installation after publishing
+ test-install:
+ needs: [publish-npm, publish-github-packages]
+ uses: ./.github/workflows/test-install.yml
diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml
new file mode 100644
index 00000000..618ad640
--- /dev/null
+++ b/.github/workflows/test-install.yml
@@ -0,0 +1,217 @@
+# Test user installation scenarios
+# Runs on: manual trigger, after release publish
+
+name: Test Install
+
+on:
+ workflow_dispatch:
+ workflow_call:
+
+jobs:
+ # Test npm install from registry (post-release)
+ test-npm-install:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ steps:
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '22'
+
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.12'
+
+ - name: Install uv
+ run: pip install uv
+
+ - name: Install machinaos from npm
+ run: npm install -g machinaos
+
+ - name: Verify installation
+ shell: bash
+ run: |
+ machinaos --help
+ machinaos --version
+
+ - name: Check whatsapp-rpc binary
+ shell: bash
+ run: |
+ INSTALL_PATH=$(npm root -g)/machinaos
+ echo "Install path: $INSTALL_PATH"
+ ls -la "$INSTALL_PATH/node_modules/whatsapp-rpc/bin/" || echo "whatsapp-rpc bin/ not found"
+
+ - name: Setup Python venv
+ shell: bash
+ run: |
+ INSTALL_PATH=$(npm root -g)/machinaos
+ cd "$INSTALL_PATH/server"
+ uv venv
+ uv sync
+
+ - name: Test start (Unix)
+ if: runner.os != 'Windows'
+ shell: bash
+ run: |
+ machinaos start &
+ PID=$!
+
+ for i in {1..15}; do
+ if curl -sf http://localhost:3010/health > /dev/null 2>&1; then
+ echo "Backend healthy after $((i*2))s"
+ break
+ fi
+ sleep 2
+ done
+
+ if kill -0 $PID 2>/dev/null; then
+ echo "machinaos start: OK"
+ machinaos stop || kill $PID 2>/dev/null || true
+ else
+ echo "machinaos start: FAILED"
+ exit 1
+ fi
+
+ - name: Test start (Windows)
+ if: runner.os == 'Windows'
+ shell: pwsh
+ run: |
+ $job = Start-Job -ScriptBlock { machinaos start }
+ Start-Sleep -Seconds 15
+
+ try {
+ $response = Invoke-WebRequest -Uri "http://localhost:3010/health" -UseBasicParsing -TimeoutSec 5
+ Write-Host "Backend healthy: $($response.StatusCode)"
+ } catch {
+ Write-Host "Backend not responding"
+ }
+
+ if ($job.State -eq "Running") {
+ Write-Host "machinaos start: OK"
+ Stop-Job $job
+ Remove-Job $job
+ } else {
+ Write-Host "machinaos start: FAILED"
+ Receive-Job $job
+ exit 1
+ }
+
+ # Test git clone + npm run build
+ test-git-clone:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest, windows-latest]
+ steps:
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '22'
+
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.12'
+
+ - name: Install uv
+ run: pip install uv
+
+ - name: Clone repository
+ run: git clone https://github.com/trohitg/MachinaOS.git
+
+ - name: Build
+ shell: bash
+ working-directory: MachinaOS
+ run: npm run build
+
+ - name: Check whatsapp-rpc binary
+ shell: bash
+ working-directory: MachinaOS
+ run: |
+ ls -la node_modules/whatsapp-rpc/bin/ || echo "whatsapp-rpc bin/ not found"
+
+ - name: Test start (Unix)
+ if: runner.os != 'Windows'
+ shell: bash
+ working-directory: MachinaOS
+ run: |
+ npm run start &
+ PID=$!
+
+ for i in {1..15}; do
+ if curl -sf http://localhost:3010/health > /dev/null 2>&1; then
+ echo "Backend healthy after $((i*2))s"
+ break
+ fi
+ sleep 2
+ done
+
+ if kill -0 $PID 2>/dev/null; then
+ echo "npm run start: OK"
+ npm run stop || kill $PID 2>/dev/null || true
+ else
+ echo "npm run start: FAILED"
+ exit 1
+ fi
+
+ - name: Test start (Windows)
+ if: runner.os == 'Windows'
+ shell: pwsh
+ working-directory: MachinaOS
+ run: |
+ $job = Start-Job -ScriptBlock {
+ Set-Location $using:PWD
+ npm run start
+ }
+ Start-Sleep -Seconds 15
+
+ try {
+ $response = Invoke-WebRequest -Uri "http://localhost:3010/health" -UseBasicParsing -TimeoutSec 5
+ Write-Host "Backend healthy: $($response.StatusCode)"
+ } catch {
+ Write-Host "Backend not responding"
+ }
+
+ if ($job.State -eq "Running") {
+ Write-Host "npm run start: OK"
+ Stop-Job $job
+ Remove-Job $job
+ } else {
+ Write-Host "npm run start: FAILED"
+ Receive-Job $job
+ exit 1
+ }
+
+ # Test install.sh script (Linux/macOS)
+ test-install-script-unix:
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest]
+ steps:
+ - name: Run install script
+ run: curl -fsSL https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.sh | bash
+
+ - name: Verify installation
+ run: |
+ machinaos --help
+ machinaos --version
+
+ # Test install.ps1 script (Windows)
+ test-install-script-windows:
+ runs-on: windows-latest
+ steps:
+ - name: Run install script
+ shell: pwsh
+ run: iwr -useb https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.ps1 | iex
+
+ - name: Verify installation
+ run: |
+ machinaos --help
+ machinaos --version