name: Main Workflow on: push: branches: [ master ] pull_request: branches: ['*'] jobs: test: name: Test runs-on: ubuntu-latest strategy: matrix: node-version: [18.x, 20.x] steps: - name: Checkout code uses: https://github.com/actions/checkout@v4 with: github-server-url: https://gitea.p-lao.com - name: Setup Node.js ${{ matrix.node-version }} uses: https://github.com/actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' - name: Install dependencies run: npm ci - name: Run tests run: npm test - name: Generate coverage report run: npm test -- --coverage --coverageReporters=lcov security: name: Security Audit runs-on: ubuntu-latest steps: - name: Checkout code uses: https://github.com/actions/checkout@v4 with: github-server-url: https://gitea.p-lao.com - name: Setup Node.js uses: https://github.com/actions/setup-node@v4 with: node-version: '18.x' cache: 'npm' - name: Install dependencies run: npm ci - name: Run security audit run: npm audit --audit-level=moderate - name: Check for vulnerabilities run: npm audit --audit-level=high --production build: name: Build runs-on: ubuntu-latest needs: [test, security] if: github.ref == 'refs/heads/master' steps: - name: Checkout code uses: https://github.com/actions/checkout@v4 with: github-server-url: https://gitea.p-lao.com - name: Setup Node.js uses: https://github.com/actions/setup-node@v4 with: node-version: '18.x' cache: 'npm' - name: Install dependencies run: npm ci - name: Build project run: npm run build - name: Create distribution package run: | mkdir -p dist cp -r build/ dist/ cp package.json dist/ cp package-lock.json dist/ cp README.md dist/ cp LICENSE dist/ cp mcp-config-example.json dist/ - name: Create tarball run: | cd dist tar -czf ../drawio-mcp-server-${{ github.sha }}.tar.gz . cd .. echo "✅ Build artifacts created: drawio-mcp-server-${{ github.sha }}.tar.gz" lint-check: name: Code Quality Check runs-on: ubuntu-latest steps: - name: Checkout code uses: https://github.com/actions/checkout@v4 with: github-server-url: https://gitea.p-lao.com - name: Setup Node.js uses: https://github.com/actions/setup-node@v4 with: node-version: '18.x' cache: 'npm' - name: Install dependencies run: npm ci - name: Check TypeScript compilation run: npx tsc --noEmit - name: Run linter with detailed output run: npm run lint -- --format=json --output-file=lint-results.json continue-on-error: true - name: Display lint summary if: always() run: | if [ -f lint-results.json ]; then echo "✅ Lint results generated: lint-results.json" echo "Lint check completed" else echo "⚠️ No lint results file found" fi notify: name: Notification runs-on: ubuntu-latest needs: [test, security, lint-check] if: always() steps: - name: Notify success if: needs.test.result == 'success' && needs.security.result == 'success' && needs.lint-check.result == 'success' run: | echo "✅ All checks passed successfully!" echo "Branch: ${{ github.ref_name }}" echo "Commit: ${{ github.sha }}" - name: Notify failure if: needs.test.result == 'failure' || needs.security.result == 'failure' || needs.lint-check.result == 'failure' run: | echo "❌ Some checks failed!" echo "Test result: ${{ needs.test.result }}" echo "Security result: ${{ needs.security.result }}" echo "Lint result: ${{ needs.lint-check.result }}" echo "Branch: ${{ github.ref_name }}" echo "Commit: ${{ github.sha }}" exit 1