fix: TypeScript build error and add Gitea CI/CD workflows
Deploy / build-and-push (push) Has been cancelled
Deploy / deploy-staging (push) Has been cancelled
Deploy / deploy-production (push) Has been cancelled
Test and Build / backend-test (push) Has been cancelled
Test and Build / frontend-test (push) Has been cancelled
Test and Build / docker-build (push) Has been cancelled
Test and Build / test-summary (push) Has been cancelled
Deploy / build-and-push (push) Has been cancelled
Deploy / deploy-staging (push) Has been cancelled
Deploy / deploy-production (push) Has been cancelled
Test and Build / backend-test (push) Has been cancelled
Test and Build / frontend-test (push) Has been cancelled
Test and Build / docker-build (push) Has been cancelled
Test and Build / test-summary (push) Has been cancelled
- Fix TypeScript type mismatch in CreateBucketDialog component - Make form fields optional to match yup schema validation - Add comprehensive Gitea Actions workflows for testing and deployment - Set up parallel testing for backend and frontend - Configure Docker build verification in CI pipeline - Add deployment workflow with staging and production environments 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,182 @@
|
||||
name: Test and Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
DOCKER_BUILDKIT: 1
|
||||
|
||||
jobs:
|
||||
# Backend Tests
|
||||
backend-test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./backend
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
cache-dependency-path: backend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run linting
|
||||
run: npm run lint
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
env:
|
||||
NODE_ENV: test
|
||||
JWT_SECRET: test-secret-key
|
||||
ADMIN_PASSWORD_HASH: $2b$12$test
|
||||
|
||||
- name: Upload coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: backend-coverage
|
||||
path: backend/coverage
|
||||
|
||||
- name: Security audit
|
||||
run: npm audit --audit-level=high
|
||||
continue-on-error: true
|
||||
|
||||
# Frontend Tests
|
||||
frontend-test:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./frontend
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --legacy-peer-deps
|
||||
|
||||
- name: Run linting
|
||||
run: npm run lint
|
||||
|
||||
- name: Run tests
|
||||
run: npm test -- --watchAll=false --passWithNoTests
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Build application
|
||||
run: npm run build
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frontend-build
|
||||
path: frontend/build
|
||||
|
||||
- name: Security audit
|
||||
run: npm audit --audit-level=high
|
||||
continue-on-error: true
|
||||
|
||||
# Docker Build Test
|
||||
docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [backend-test, frontend-test]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build Backend Docker Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./backend
|
||||
file: ./docker/Dockerfile.backend
|
||||
push: false
|
||||
tags: minio-webui-backend:test
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Build Frontend Docker Image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./frontend
|
||||
file: ./docker/Dockerfile.frontend
|
||||
push: false
|
||||
tags: minio-webui-frontend:test
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
- name: Test Docker Compose
|
||||
run: |
|
||||
# Create test .env file
|
||||
cat > .env << EOF
|
||||
NODE_ENV=test
|
||||
PORT=3000
|
||||
LOG_LEVEL=info
|
||||
ADMIN_PASSWORD_HASH=\$2b\$12\$test
|
||||
JWT_SECRET=test-secret-key
|
||||
SESSION_TIMEOUT=1800
|
||||
ENABLE_IP_RESTRICTION=false
|
||||
DEFAULT_MINIO_ALIAS=testminio
|
||||
MINIO_ENDPOINT=http://minio:9000
|
||||
MINIO_ACCESS_KEY=minioadmin
|
||||
MINIO_SECRET_KEY=minioadmin
|
||||
EOF
|
||||
|
||||
# Start services
|
||||
docker compose up -d
|
||||
|
||||
# Wait for services to be healthy
|
||||
sleep 30
|
||||
|
||||
# Check if services are running
|
||||
docker compose ps
|
||||
|
||||
# Test backend health endpoint
|
||||
curl -f http://localhost:3000/health || exit 1
|
||||
|
||||
# Test frontend
|
||||
curl -f http://localhost/health || exit 1
|
||||
|
||||
# Clean up
|
||||
docker compose down -v
|
||||
|
||||
# Summary job for branch protection
|
||||
test-summary:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [backend-test, frontend-test, docker-build]
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
- name: Test Summary
|
||||
run: |
|
||||
echo "## Test Summary"
|
||||
echo "Backend Tests: ${{ needs.backend-test.result }}"
|
||||
echo "Frontend Tests: ${{ needs.frontend-test.result }}"
|
||||
echo "Docker Build: ${{ needs.docker-build.result }}"
|
||||
|
||||
if [ "${{ needs.backend-test.result }}" != "success" ] || \
|
||||
[ "${{ needs.frontend-test.result }}" != "success" ] || \
|
||||
[ "${{ needs.docker-build.result }}" != "success" ]; then
|
||||
echo "::error::One or more tests failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "All tests passed successfully!"
|
||||
Reference in New Issue
Block a user