Merge pull request #319 from platonai/copilot/improve-agentfilesystem #121
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: CI/CD Pipeline | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+-ci.[0-9]+' | |
| - 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+-ci.[0-9]+' | |
| paths: | |
| - '**/*.java' | |
| - '**/*.kt' | |
| workflow_dispatch: | |
| inputs: | |
| skip_tests: | |
| description: 'Skip tests' | |
| required: false | |
| default: false | |
| type: boolean | |
| debug_mode: | |
| description: 'Enable debug mode' | |
| required: false | |
| default: false | |
| type: boolean | |
| env: | |
| IMAGE_NAME: browser4 | |
| NETWORK_NAME: 'browser4_backend' | |
| CONTAINER_NAME: 'browser4-test' | |
| DOCKER_COMPOSE_FILE: './docker-compose.yml' | |
| DEPENDENCY_SERVICES: 'mongodb' | |
| MONGODB_CONTAINER: 'mongodb' | |
| MONGODB_PORT: '27017' | |
| JAVA_VERSION: '17' | |
| MAVEN_OPTS: '-Xmx3g -XX:+UseG1GC' | |
| jobs: | |
| ci-build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image_tag: ${{ steps.build.outputs.image_tag }} | |
| test_results: ${{ steps.tests.outputs.test_status }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Environment | |
| id: setup | |
| uses: ./.github/actions/setup-environment | |
| with: | |
| java_version: ${{ env.JAVA_VERSION }} | |
| - name: Verify Dependencies | |
| id: deps | |
| uses: ./.github/actions/verify-dependencies | |
| with: | |
| network_name: ${{ env.NETWORK_NAME }} | |
| compose_file: ${{ env.DOCKER_COMPOSE_FILE }} | |
| services_to_start: ${{ env.DEPENDENCY_SERVICES }} | |
| mongodb_container: ${{ env.MONGODB_CONTAINER }} | |
| mongodb_port: ${{ env.MONGODB_PORT }} | |
| startup_timeout: '120' | |
| verify_network_connectivity: 'true' | |
| - name: Maven Build | |
| id: build-maven | |
| uses: ./.github/actions/maven-build | |
| with: | |
| skip_tests: ${{ inputs.skip_tests || 'true' }} | |
| timeout_minutes: '15' | |
| - name: Run Tests | |
| id: run-tests | |
| if: inputs.skip_tests != true | |
| uses: ./.github/actions/run-tests | |
| with: | |
| maven_profiles: 'all-modules' | |
| # Exclude integration and e2e tests in this CI build | |
| # test_excludes: '**integration**,**e2e**' | |
| timeout_minutes: '35' | |
| - name: Check Test Status | |
| if: inputs.skip_tests != true | |
| run: | | |
| if [ "${{ steps.run-tests.outputs.test_status }}" != "success" ]; then | |
| echo "❌ Tests failed with status: ${{ steps.run-tests.outputs.test_status }}" | |
| echo "📊 Test Results:" | |
| echo " - Total Tests: ${{ steps.run-tests.outputs.test_count }}" | |
| echo " - Failed Tests: ${{ steps.run-tests.outputs.failed_count }}" | |
| echo " - Passed Tests: ${{ steps.run-tests.outputs.passed_count }}" | |
| echo " - Skipped Tests: ${{ steps.run-tests.outputs.skipped_count }}" | |
| exit 1 | |
| else | |
| echo "✅ All tests passed successfully" | |
| echo "📊 Test Results: ${{ steps.run-tests.outputs.passed_count }} tests passed" | |
| fi | |
| - name: Cleanup Docker system to free space | |
| run: | | |
| docker system prune -af | |
| docker volume prune -f | |
| rm -rf ~/.m2/repository # If you no longer need Maven cache | |
| sudo apt-get clean | |
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
| sudo df -h | |
| - name: Build Docker Image | |
| id: build | |
| uses: ./.github/actions/docker-build | |
| with: | |
| image_name: ${{ env.IMAGE_NAME }} | |
| version: ${{ github.sha }} | |
| timeout_minutes: '20' | |
| - name: Start Application | |
| id: app | |
| uses: ./.github/actions/start-application | |
| with: | |
| image_name: ${{ env.IMAGE_NAME }} | |
| version: ${{ github.sha }} | |
| container_name: ${{ env.CONTAINER_NAME }} | |
| network_name: ${{ env.NETWORK_NAME }} | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| proxy_rotation_url: ${{ secrets.PROXY_ROTATION_URL }} | |
| - name: Health Check | |
| id: health | |
| uses: ./.github/actions/health-check | |
| with: | |
| service_port: '8182' | |
| timeout_minutes: '5' | |
| container_name: ${{ env.CONTAINER_NAME }} | |
| - name: Run End to End Tests | |
| id: end-to-end-tests | |
| shell: bash | |
| run: | | |
| echo "::group::🧪 End to End Tests" | |
| if [ -f "./bin/tests/run-e2e-tests.sh" ]; then | |
| echo "✅ Found E2E test script" | |
| chmod +x ./bin/tests/run-e2e-tests.sh | |
| find -name "*.sh" -exec chmod +x {} \; | |
| echo "🚀 Running E2E tests..." | |
| date | |
| echo "Application URL: http://localhost:8182" | |
| echo "Network: ${{ env.NETWORK_NAME }}" | |
| echo "Container: ${{ env.CONTAINER_NAME }}" | |
| if timeout 1200 ./bin/tests/run-e2e-tests.sh; then | |
| echo "✅ E2E tests passed" | |
| echo "e2e_status=success" >> $GITHUB_OUTPUT | |
| else | |
| echo "❌ E2E tests failed" | |
| echo "e2e_status=failed" >> $GITHUB_OUTPUT | |
| exit 1 | |
| fi | |
| else | |
| echo "⚠️ E2E test script not found: ./bin/tests/run-e2e-tests.sh" | |
| echo "Skipping E2E tests..." | |
| echo "e2e_status=skipped" >> $GITHUB_OUTPUT | |
| fi | |
| echo "::endgroup::" | |
| - name: Pipeline Summary | |
| if: always() | |
| shell: bash | |
| run: | | |
| echo "::group::📊 Pipeline Summary" | |
| echo "🎯 Pipeline Results:" | |
| echo " - Setup: ${{ steps.setup.outcome }}" | |
| echo " - Dependencies: ${{ steps.deps.outcome }}" | |
| echo " - Maven Build: ${{ steps.build-maven.outcome }}" | |
| echo " - Unit Tests: ${{ steps.run-tests.outcome || 'skipped' }}" | |
| echo " - Docker Build: ${{ steps.build.outcome }}" | |
| echo " - Application: ${{ steps.app.outcome }}" | |
| echo " - Health Check: ${{ steps.health.outcome }}" | |
| echo " - E2E Tests: ${{ steps.end-to-end-tests.outcome || 'skipped' }}" | |
| echo "" | |
| echo "🌐 Infrastructure:" | |
| echo " - Network: ${{ env.NETWORK_NAME }}" | |
| echo " - Container: ${{ env.CONTAINER_NAME }}" | |
| echo " - Image: ${{ env.IMAGE_NAME }}:${{ github.sha }}" | |
| echo " - MongoDB: ${{ steps.deps.outputs.mongodb_status }}" | |
| echo " - Redis: ${{ steps.deps.outputs.redis_status }}" | |
| echo "" | |
| echo "📅 Completed at: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" | |
| echo "👤 Triggered by: ${{ github.actor }}" | |
| echo "🌟 Commit: ${{ github.sha }}" | |
| echo "::endgroup::" | |
| - name: Cleanup Resources | |
| if: always() | |
| uses: ./.github/actions/cleanup-resources | |
| with: | |
| container_name: ${{ env.CONTAINER_NAME }} | |
| cleanup_compose: 'true' | |
| cleanup_volumes: 'true' | |
| network_name: ${{ env.NETWORK_NAME }} |