mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-01 09:14:56 +00:00
feat: Add external low-code and postgres repositories
- codegen: Low-code React app with JSON-driven component system - packagerepo: Schema-driven package repository with backend/frontend - postgres: Next.js app with Drizzle ORM and PostgreSQL Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
87
codegen/.github/WORKFLOW_FIXES.md
vendored
Normal file
87
codegen/.github/WORKFLOW_FIXES.md
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
# GitHub Actions Workflow Fixes
|
||||
|
||||
## Summary of Changes
|
||||
|
||||
### 1. Fixed ci.yml (Lines 236 & 261)
|
||||
**Problem**: Unrecognized named-value 'secrets' in conditional expressions
|
||||
```yaml
|
||||
# ❌ BEFORE (Invalid)
|
||||
if: always() && secrets.SLACK_WEBHOOK_URL != ''
|
||||
|
||||
# ✅ AFTER (Valid)
|
||||
if: always() && env.SLACK_WEBHOOK_URL != ''
|
||||
```
|
||||
|
||||
**Explanation**: Secrets cannot be directly referenced in conditional expressions. They must be assigned to environment variables first, then checked via `env.VARIABLE_NAME`.
|
||||
|
||||
### 2. Fixed e2e-tests.yml
|
||||
**Problems**:
|
||||
- Used `npm install --workspaces` which isn't appropriate for this project structure
|
||||
- Missing check for test existence before running
|
||||
- Timeout issues (180s was too long)
|
||||
- Missing individual step timeouts
|
||||
|
||||
**Changes**:
|
||||
- Replaced `npm install --workspaces --legacy-peer-deps` with `npm install`
|
||||
- Added test existence check before running E2E tests
|
||||
- Added skip step when no tests are configured
|
||||
- Reduced webServer timeout from 180s to 120s
|
||||
- Added 30-minute job timeout
|
||||
- Added 20-minute step timeout for test execution
|
||||
- Only install chromium browser (not all browsers)
|
||||
|
||||
### 3. Updated Playwright Configuration
|
||||
**Changes**:
|
||||
- Reduced test timeout from 60s to 30s
|
||||
- Reduced expect timeout from 15s to 10s
|
||||
- Reduced action timeout from 15s to 10s
|
||||
- Reduced navigation timeout from 30s to 20s
|
||||
- Reduced webServer startup timeout from 180s to 120s
|
||||
|
||||
### 4. Replaced `npm ci` with `npm install`
|
||||
**Reason**: The package.json uses `file:` protocol for local packages which sometimes causes issues with `npm ci` when package-lock.json is out of sync. Using `npm install` is more forgiving and works better with the local package setup.
|
||||
|
||||
**Jobs Updated**:
|
||||
- lint
|
||||
- test
|
||||
- build
|
||||
- e2e-tests
|
||||
- security-scan
|
||||
|
||||
## Remaining Issues to Address
|
||||
|
||||
### Docker Build
|
||||
The Docker build still fails due to workspace protocol. The Dockerfile already uses `npm install --legacy-peer-deps` which should work, but ensure:
|
||||
1. The packages directories are properly copied before npm install
|
||||
2. Consider using a .dockerignore file to exclude unnecessary files
|
||||
|
||||
### E2E Test Stability
|
||||
To improve E2E test reliability:
|
||||
1. Add retry logic for flaky tests
|
||||
2. Use `wait-on` package to ensure dev server is fully ready
|
||||
3. Consider adding health check endpoint
|
||||
4. Add individual test timeouts to catch hanging tests
|
||||
|
||||
### Security Scan Permissions
|
||||
If security scan upload fails, ensure the repository has:
|
||||
- Security events write permission enabled
|
||||
- Code scanning enabled in repository settings
|
||||
|
||||
## Testing the Fixes
|
||||
|
||||
Run workflows manually to test:
|
||||
```bash
|
||||
# Test lint job
|
||||
gh workflow run ci.yml --ref main
|
||||
|
||||
# Test E2E specifically
|
||||
gh workflow run e2e-tests.yml --ref main
|
||||
```
|
||||
|
||||
## Future Improvements
|
||||
|
||||
1. **Caching**: Add npm cache to speed up builds
|
||||
2. **Matrix Testing**: Test on multiple Node versions
|
||||
3. **Conditional Jobs**: Skip Docker build on PR
|
||||
4. **Slack Integration**: Set up SLACK_WEBHOOK_URL secret for notifications
|
||||
5. **Test Reporting**: Add test result annotations to PRs
|
||||
11
codegen/.github/dependabot.yml
vendored
Normal file
11
codegen/.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
|
||||
- package-ecosystem: "devcontainers"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
290
codegen/.github/workflows/ci.yml
vendored
Normal file
290
codegen/.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,290 @@
|
||||
name: CI/CD Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20.x'
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run ESLint
|
||||
run: npm run lint:check
|
||||
|
||||
- name: Type check
|
||||
run: npx tsc --noEmit
|
||||
|
||||
test:
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run unit tests
|
||||
run: npm test --if-present || echo "No test script found"
|
||||
|
||||
- name: Upload coverage reports
|
||||
uses: codecov/codecov-action@v4
|
||||
if: always()
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./coverage/coverage-final.json
|
||||
flags: unittests
|
||||
fail_ci_if_error: false
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Prepare build directories
|
||||
run: |
|
||||
mkdir -p /tmp/dist
|
||||
mkdir -p dist
|
||||
|
||||
- name: Build application
|
||||
run: npm run build
|
||||
|
||||
- name: Verify build output
|
||||
run: |
|
||||
if [ ! -f "dist/index.html" ]; then
|
||||
echo "Error: Build failed - index.html not found"
|
||||
exit 1
|
||||
fi
|
||||
echo "Build successful - all artifacts generated"
|
||||
ls -lah dist/
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
retention-days: 7
|
||||
|
||||
e2e-tests:
|
||||
name: E2E Tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
||||
|
||||
- name: Check if E2E tests exist
|
||||
id: check-tests
|
||||
run: |
|
||||
if [ -d "e2e" ] && [ "$(ls -A e2e/*.spec.ts 2>/dev/null)" ]; then
|
||||
echo "has_tests=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_tests=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Run E2E tests
|
||||
if: steps.check-tests.outputs.has_tests == 'true'
|
||||
run: npx playwright test
|
||||
timeout-minutes: 20
|
||||
|
||||
- name: Skip E2E tests
|
||||
if: steps.check-tests.outputs.has_tests == 'false'
|
||||
run: echo "No E2E tests configured - skipping"
|
||||
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always() && steps.check-tests.outputs.has_tests == 'true'
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 7
|
||||
|
||||
security-scan:
|
||||
name: Security Scan
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
actions: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run npm audit
|
||||
run: npm audit --audit-level=moderate || true
|
||||
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
scan-ref: '.'
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
|
||||
- name: Upload Trivy results to GitHub Security
|
||||
uses: github/codeql-action/upload-sarif@v4
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
|
||||
docker-build:
|
||||
name: Build Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test, build]
|
||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=sha,prefix={{branch}}-
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
deploy-staging:
|
||||
name: Deploy to Staging
|
||||
runs-on: ubuntu-latest
|
||||
needs: [docker-build]
|
||||
if: github.ref == 'refs/heads/develop'
|
||||
environment:
|
||||
name: staging
|
||||
url: https://staging.codeforge.example.com
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy to staging
|
||||
run: |
|
||||
echo "Deploying to staging environment..."
|
||||
echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:develop-${{ github.sha }}"
|
||||
|
||||
- name: Notify deployment
|
||||
uses: 8398a7/action-slack@v3
|
||||
if: always() && env.SLACK_WEBHOOK_URL != ''
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
text: 'Staging deployment ${{ job.status }}'
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
|
||||
deploy-production:
|
||||
name: Deploy to Production
|
||||
runs-on: ubuntu-latest
|
||||
needs: [docker-build, e2e-tests]
|
||||
if: github.ref == 'refs/heads/main'
|
||||
environment:
|
||||
name: production
|
||||
url: https://codeforge.example.com
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Deploy to production
|
||||
run: |
|
||||
echo "Deploying to production environment..."
|
||||
echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:main-${{ github.sha }}"
|
||||
|
||||
- name: Notify deployment
|
||||
uses: 8398a7/action-slack@v3
|
||||
if: always() && env.SLACK_WEBHOOK_URL != ''
|
||||
with:
|
||||
status: ${{ job.status }}
|
||||
text: 'Production deployment ${{ job.status }}'
|
||||
env:
|
||||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
|
||||
62
codegen/.github/workflows/e2e-tests.yml
vendored
Normal file
62
codegen/.github/workflows/e2e-tests.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: E2E Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main, develop ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Check if E2E tests exist
|
||||
id: check-tests
|
||||
run: |
|
||||
if [ -d "e2e" ] && [ "$(ls -A e2e/*.spec.ts 2>/dev/null)" ]; then
|
||||
echo "has_tests=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "has_tests=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Run Playwright tests
|
||||
if: steps.check-tests.outputs.has_tests == 'true'
|
||||
run: npx playwright test
|
||||
timeout-minutes: 30
|
||||
|
||||
- name: Skip E2E tests
|
||||
if: steps.check-tests.outputs.has_tests == 'false'
|
||||
run: echo "No E2E tests configured - skipping"
|
||||
|
||||
- name: Upload Playwright Report
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always() && steps.check-tests.outputs.has_tests == 'true'
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload Test Results
|
||||
uses: actions/upload-artifact@v4
|
||||
if: always() && steps.check-tests.outputs.has_tests == 'true'
|
||||
with:
|
||||
name: test-results
|
||||
path: test-results/
|
||||
retention-days: 30
|
||||
26
codegen/.github/workflows/mirror-repository.yml
vendored
Normal file
26
codegen/.github/workflows/mirror-repository.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: mirror-repository
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
mirror:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Mirror repository
|
||||
uses: yesolutions/mirror-action@v0.7.0
|
||||
with:
|
||||
REMOTE_NAME: git
|
||||
REMOTE: https://git.wardcrew.com/git/lowcodereact.git
|
||||
GIT_USERNAME: git
|
||||
GIT_PASSWORD: 4wHhnUX7n7pVaFZi
|
||||
PUSH_ALL_REFS: true
|
||||
GIT_PUSH_ARGS: --tags --force --prune
|
||||
95
codegen/.github/workflows/release.yml
vendored
Normal file
95
codegen/.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20.x'
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install --workspaces --legacy-peer-deps
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Create ZIP archive
|
||||
run: |
|
||||
cd dist
|
||||
zip -r ../codeforge-${{ github.ref_name }}.zip .
|
||||
cd ..
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
run: |
|
||||
echo "## Changes" > CHANGELOG.md
|
||||
git log $(git describe --tags --abbrev=0 HEAD^)..HEAD --pretty=format:"- %s (%h)" >> CHANGELOG.md
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: codeforge-${{ github.ref_name }}.zip
|
||||
body_path: CHANGELOG.md
|
||||
draft: false
|
||||
prerelease: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.VERSION }}
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.title=CodeForge
|
||||
org.opencontainers.image.description=Low-Code Next.js App Builder
|
||||
org.opencontainers.image.version=${{ steps.version.outputs.VERSION }}
|
||||
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
Reference in New Issue
Block a user