-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Contract Testing & Integration Test CI #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,164 @@ | |||||||||||||||||||||||||||||
| name: Integration Tests | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||
| branches: [main] | |||||||||||||||||||||||||||||
| pull_request: | |||||||||||||||||||||||||||||
| branches: [main] | |||||||||||||||||||||||||||||
| workflow_dispatch: | |||||||||||||||||||||||||||||
| inputs: | |||||||||||||||||||||||||||||
| agent_url: | |||||||||||||||||||||||||||||
| description: 'AxonFlow Agent URL (defaults to staging)' | |||||||||||||||||||||||||||||
| required: false | |||||||||||||||||||||||||||||
| default: 'https://staging-eu.getaxonflow.com' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| # Note: github.event.inputs only available on workflow_dispatch, defaults used otherwise | |||||||||||||||||||||||||||||
| AXONFLOW_AGENT_URL: ${{ github.event.inputs.agent_url || 'https://staging-eu.getaxonflow.com' }} | |||||||||||||||||||||||||||||
| AXONFLOW_CLIENT_ID: ${{ secrets.AXONFLOW_CLIENT_ID || 'demo-client' }} | |||||||||||||||||||||||||||||
| AXONFLOW_CLIENT_SECRET: ${{ secrets.AXONFLOW_CLIENT_SECRET || 'demo-secret' }} | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||
| contract-tests: | |||||||||||||||||||||||||||||
| name: Contract Tests | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: '3.11' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: pip install -e ".[dev]" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run contract tests | |||||||||||||||||||||||||||||
| run: pytest tests/test_contract.py -v --no-cov | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| integration-tests: | |||||||||||||||||||||||||||||
| name: Integration Tests | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| # Only run on main branch or manual dispatch with secrets configured | |||||||||||||||||||||||||||||
| if: github.event_name == 'workflow_dispatch' || (github.ref == 'refs/heads/main' && github.event_name == 'push') | |||||||||||||||||||||||||||||
| needs: contract-tests | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: '3.11' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: pip install -e ".[dev,all]" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run integration tests | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| RUN_INTEGRATION_TESTS: '1' | |||||||||||||||||||||||||||||
| AXONFLOW_LICENSE_KEY: ${{ secrets.AXONFLOW_LICENSE_KEY }} | |||||||||||||||||||||||||||||
| run: pytest tests/test_integration.py -v --no-cov | |||||||||||||||||||||||||||||
| continue-on-error: true # Don't fail build if staging is down | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| demo-scripts: | |||||||||||||||||||||||||||||
|
Comment on lines
+40
to
+63
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 4 months ago To fix the problem, add a
Suggested changeset
1
.github/workflows/integration.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: Demo Scripts Validation | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| needs: contract-tests | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: '3.11' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: pip install -e ".[dev,all]" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Validate quickstart.py syntax | |||||||||||||||||||||||||||||
| run: python -m py_compile examples/quickstart.py | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Validate gateway_mode.py syntax | |||||||||||||||||||||||||||||
| run: python -m py_compile examples/gateway_mode.py | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Validate openai_integration.py syntax | |||||||||||||||||||||||||||||
| run: python -m py_compile examples/openai_integration.py | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run quickstart (dry-run mode) | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -c " | |||||||||||||||||||||||||||||
| import asyncio | |||||||||||||||||||||||||||||
| from examples.quickstart import main | |||||||||||||||||||||||||||||
| # Verify module imports correctly | |||||||||||||||||||||||||||||
| print('quickstart.py imports successfully') | |||||||||||||||||||||||||||||
| " | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run gateway_mode (dry-run mode) | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| python -c " | |||||||||||||||||||||||||||||
| import asyncio | |||||||||||||||||||||||||||||
| from examples.gateway_mode import main, blocked_example | |||||||||||||||||||||||||||||
| # Verify module imports correctly | |||||||||||||||||||||||||||||
| print('gateway_mode.py imports successfully') | |||||||||||||||||||||||||||||
| " | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| community-stack-tests: | |||||||||||||||||||||||||||||
|
Comment on lines
+64
to
+105
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 4 months ago To fix this issue, we should add a This addition should be made at the same indentation level as
Suggested changeset
1
.github/workflows/integration.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| name: Community Stack E2E | |||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||
| if: github.event_name == 'workflow_dispatch' | |||||||||||||||||||||||||||||
| needs: [contract-tests, demo-scripts] | |||||||||||||||||||||||||||||
| services: | |||||||||||||||||||||||||||||
| agent: | |||||||||||||||||||||||||||||
| image: ghcr.io/getaxonflow/axonflow-agent:latest | |||||||||||||||||||||||||||||
| ports: | |||||||||||||||||||||||||||||
| - 8080:8080 | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| AXONFLOW_MODE: community | |||||||||||||||||||||||||||||
| AXONFLOW_DEBUG: 'true' | |||||||||||||||||||||||||||||
| options: >- | |||||||||||||||||||||||||||||
| --health-cmd "wget --spider -q http://localhost:8080/health || exit 1" | |||||||||||||||||||||||||||||
| --health-interval 10s | |||||||||||||||||||||||||||||
| --health-timeout 5s | |||||||||||||||||||||||||||||
| --health-retries 5 | |||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Set up Python | |||||||||||||||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||
| python-version: '3.11' | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Install dependencies | |||||||||||||||||||||||||||||
| run: pip install -e ".[dev,all]" | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Wait for agent to be ready | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| for i in {1..30}; do | |||||||||||||||||||||||||||||
| if curl -s http://localhost:8080/health | grep -q healthy; then | |||||||||||||||||||||||||||||
| echo "Agent is ready!" | |||||||||||||||||||||||||||||
| exit 0 | |||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||
| echo "Waiting for agent... ($i/30)" | |||||||||||||||||||||||||||||
| sleep 2 | |||||||||||||||||||||||||||||
| done | |||||||||||||||||||||||||||||
| echo "Agent failed to start" | |||||||||||||||||||||||||||||
| exit 1 | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run SDK against community stack | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| AXONFLOW_AGENT_URL: 'http://localhost:8080' | |||||||||||||||||||||||||||||
| AXONFLOW_CLIENT_ID: 'test-client' | |||||||||||||||||||||||||||||
| AXONFLOW_CLIENT_SECRET: 'test-secret' | |||||||||||||||||||||||||||||
| RUN_INTEGRATION_TESTS: '1' | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| # Run integration tests against local community stack | |||||||||||||||||||||||||||||
| pytest tests/test_integration.py -v --no-cov | |||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||
| - name: Run demo scripts against community stack | |||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||
| AXONFLOW_AGENT_URL: 'http://localhost:8080' | |||||||||||||||||||||||||||||
| AXONFLOW_CLIENT_ID: 'test-client' | |||||||||||||||||||||||||||||
| AXONFLOW_CLIENT_SECRET: 'test-secret' | |||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||
| # Run quickstart demo | |||||||||||||||||||||||||||||
| python examples/quickstart.py || echo "Quickstart completed (may fail without LLM)" | |||||||||||||||||||||||||||||
|
Comment on lines
+106
to
+164
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 4 months ago The best way to fix the problem is to add a Steps:
Suggested changeset
1
.github/workflows/integration.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ | |
| TokenUsage, | ||
| ) | ||
|
|
||
| __version__ = "0.1.0" | ||
| __version__ = "0.2.0" | ||
| __all__ = [ | ||
| # Main client | ||
| "AxonFlow", | ||
|
|
||
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 4 months ago
To resolve the problem, add an explicit
permissionssection at the root of the workflow file (.github/workflows/integration.yml). This ensures all jobs in the workflow are run with the minimum necessary privileges on theGITHUB_TOKEN. The best practice is to setpermissions: { contents: read }unless specific jobs need something else (e.g., writing pull requests or issues). In this workflow, all jobs only need to read code, so adding the following near the top of the file is appropriate:This line should be inserted after the
name: Integration Testsand before theon:block (typically at line 2). No further changes are needed, as none of the jobs appear to need broader permissions.