Fix VC CLI workflow verification and tests #26
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: Functional Tests | |
| on: | |
| push: | |
| branches: | |
| - testing | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| storage_mode: | |
| description: 'Storage mode to test' | |
| required: false | |
| default: 'both' | |
| type: choice | |
| options: | |
| - both | |
| - local | |
| - postgres | |
| openrouter_model: | |
| description: 'OpenRouter model to use' | |
| required: false | |
| default: 'openrouter/google/gemini-2.5-flash-lite' | |
| type: string | |
| jobs: | |
| functional-tests: | |
| name: Functional Tests (${{ matrix.storage_mode }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| storage_mode: | |
| - local | |
| - postgres | |
| env: | |
| OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }} | |
| OPENROUTER_MODEL: ${{ github.event.inputs.openrouter_model || 'openrouter/google/gemini-2.5-flash-lite' }} | |
| DOCKER_BUILDKIT: 1 | |
| COMPOSE_DOCKER_CLI_BUILD: 1 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Prepare artifact directories | |
| run: | | |
| mkdir -p test-reports tests/functional/logs | |
| chmod -R 777 test-reports tests/functional/logs | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Cache Docker layers | |
| uses: actions/cache@v3 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: ${{ runner.os }}-buildx-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-buildx- | |
| - name: Verify OpenRouter configuration | |
| run: | | |
| if [ -z "$OPENROUTER_API_KEY" ]; then | |
| echo "::error::OPENROUTER_API_KEY secret is not set" | |
| echo "Please add your OpenRouter API key as a repository secret" | |
| exit 1 | |
| fi | |
| echo "✓ OPENROUTER_API_KEY is configured" | |
| echo "✓ OPENROUTER_MODEL: $OPENROUTER_MODEL" | |
| - name: Run functional tests (${{ matrix.storage_mode }}) | |
| run: | | |
| cd tests/functional | |
| if [ "${{ matrix.storage_mode }}" = "local" ]; then | |
| docker compose -f docker/docker-compose.local.yml up \ | |
| --build \ | |
| --abort-on-container-exit \ | |
| --exit-code-from test-runner | |
| else | |
| docker compose -f docker/docker-compose.postgres.yml up \ | |
| --build \ | |
| --abort-on-container-exit \ | |
| --exit-code-from test-runner | |
| fi | |
| - name: Collect functional logs and reports | |
| if: always() | |
| run: | | |
| mkdir -p test-reports | |
| # Copy logs from mounted volume | |
| if [ -f tests/functional/logs/functional-tests.log ]; then | |
| cp tests/functional/logs/functional-tests.log test-reports/functional-tests-${{ matrix.storage_mode }}.log | |
| fi | |
| # Extract JUnit XML from container | |
| cd tests/functional | |
| CONTAINER_NAME="agentfield-test-runner-${{ matrix.storage_mode }}" | |
| docker cp ${CONTAINER_NAME}:/reports/junit-${{ matrix.storage_mode }}.xml ../../test-reports/ 2>/dev/null || echo "No JUnit report found in container" | |
| - name: Upload test reports | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-reports-${{ matrix.storage_mode }} | |
| path: test-reports/ | |
| retention-days: 1 | |
| - name: Upload logs | |
| if: failure() | |
| run: | | |
| mkdir -p logs | |
| cd tests/functional | |
| docker compose -f docker/docker-compose.${{ matrix.storage_mode }}.yml logs > ../../logs/docker-${{ matrix.storage_mode }}.log || true | |
| - name: Upload failure logs | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: logs-${{ matrix.storage_mode }} | |
| path: logs/ | |
| retention-days: 1 | |
| - name: Cleanup | |
| if: always() | |
| run: | | |
| cd tests/functional | |
| docker compose -f docker/docker-compose.${{ matrix.storage_mode }}.yml down -v || true | |
| test-summary: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: functional-tests | |
| if: always() | |
| steps: | |
| - name: Check test results | |
| run: | | |
| if [ "${{ needs.functional-tests.result }}" = "failure" ]; then | |
| echo "::error::Functional tests failed" | |
| exit 1 | |
| elif [ "${{ needs.functional-tests.result }}" = "cancelled" ]; then | |
| echo "::warning::Functional tests were cancelled" | |
| exit 1 | |
| else | |
| echo "✅ All functional tests passed" | |
| fi |