Adds links to the cloud connector doc, removes old docs #83
Workflow file for this run
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: Test | |
| on: | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint-and-typecheck: | |
| name: Lint & Typecheck | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run linter | |
| run: npm run lint:ts | |
| - name: Run type check | |
| run: npm run typecheck | |
| unit-tests: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run unit tests | |
| run: npm run test:unit | |
| integration-tests: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| services: | |
| mongodb: | |
| image: mongo:6 | |
| ports: | |
| - 27017:27017 | |
| options: >- | |
| --health-cmd "mongosh --eval 'db.runCommand({ping:1})'" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| redis: | |
| image: redis:7-alpine | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build TypeScript | |
| run: npm run build | |
| - name: Create logs directory | |
| run: mkdir -p logs | |
| - name: Seed test database | |
| run: npx tsx tests/integration/seed-database.ts | |
| env: | |
| MONGO_HOST: localhost | |
| MONGO_PORT: 27017 | |
| MONGO_DB: openhab_test | |
| - name: Start application | |
| run: | | |
| npm start > app.log 2>&1 & | |
| echo $! > app.pid | |
| echo "App started with PID $(cat app.pid)" | |
| env: | |
| NODE_ENV: test | |
| CONFIG_PATH: ./docker/config.ci.json | |
| - name: Wait for application to be ready | |
| run: | | |
| echo "Waiting for app to start..." | |
| for i in {1..60}; do | |
| sleep 1 | |
| # Check if process is still running | |
| if ! ps -p $(cat app.pid) > /dev/null 2>&1; then | |
| echo "=== Process died! Showing logs ===" | |
| cat app.log || true | |
| exit 1 | |
| fi | |
| # Try health check | |
| RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/health 2>/dev/null || echo "000") | |
| echo "Attempt $i: HTTP $RESPONSE" | |
| if [ "$RESPONSE" = "200" ]; then | |
| echo "Health check passed!" | |
| # Verify a few more endpoints work | |
| echo "Testing login page..." | |
| LOGIN_RESP=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/login 2>/dev/null || echo "000") | |
| echo "Login page: HTTP $LOGIN_RESP" | |
| # Check process is still alive after requests | |
| if ! ps -p $(cat app.pid) > /dev/null 2>&1; then | |
| echo "=== Process crashed after health check! ===" | |
| cat app.log || true | |
| exit 1 | |
| fi | |
| echo "Server is ready!" | |
| exit 0 | |
| fi | |
| # Show more detail if we get a response but not 200 | |
| if [ "$RESPONSE" != "000" ]; then | |
| echo "Got response, checking body:" | |
| curl -s http://localhost:3000/health || true | |
| fi | |
| done | |
| echo "=== Timeout - showing full logs ===" | |
| cat app.log || true | |
| exit 1 | |
| - name: Run integration tests | |
| run: npm run test:integration | |
| timeout-minutes: 5 | |
| env: | |
| SERVER_URL: http://127.0.0.1:3000 | |
| - name: Show application logs on failure | |
| if: failure() | |
| run: cat app.log || true |