feat: Add VPS deployment guide, include package-lock.json, and update… #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Node.js CI | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x, 20.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Install Playwright browsers | |
| run: npx playwright install --with-deps chromium | |
| - name: Start server in background | |
| run: | | |
| RENDERER_API_KEY=test123 node server.js & | |
| echo $! > server.pid | |
| - name: Wait for server to start | |
| run: sleep 5 | |
| - name: Test health endpoint | |
| run: | | |
| curl -f http://localhost:3000/health || exit 1 | |
| - name: Test screenshot endpoint | |
| run: | | |
| curl -X POST http://localhost:3000/screenshot \ | |
| -H "Authorization: Bearer test123" \ | |
| -H "Content-Type: application/json" \ | |
| -o screenshot.png \ | |
| -d '{"url": "https://example.com"}' || exit 1 | |
| - name: Stop server | |
| if: always() | |
| run: | | |
| if [ -f server.pid ]; then | |
| kill $(cat server.pid) || true | |
| fi |