-
Notifications
You must be signed in to change notification settings - Fork 10
Rewrite test directory and add github workflow to run test #43
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3e9671f
add integration and unit tests for reading bot
199472b
Rewrite tests for bots
2fb1e88
Rewrite docker environment tests
2ec9554
Add workflow for tests
5e05315
Change model for brwsing bot
090ab70
set env variables
b37c54d
RUn for only 1 python version
1bd93fb
make to run only integration tests
25401c6
remove docker tests step
a8ffc17
Correct syntax error
cb814bb
add heredoc execution test
17fdf4d
Update ShellCommunicator to handle heredoc commands
0xba1a b289dc7
add codecov
a4a1da4
change branch to main
fb85cfe
Apply suggestion from @0xba1a
0xba1a dc62b44
Apply suggestion from @0xba1a
0xba1a cdef6d3
Apply suggestion from @0xba1a
0xba1a a828384
Apply suggestion from @0xba1a
0xba1a File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| coverage: | ||
| status: | ||
| project: | ||
| default: | ||
| target: auto | ||
| threshold: 1% | ||
| informational: true | ||
| patch: | ||
| default: | ||
| target: 100% | ||
| threshold: 1% | ||
| informational: false | ||
|
|
||
| comment: | ||
| layout: "reach,diff,flags,tree" | ||
| behavior: default | ||
| require_changes: false | ||
|
|
||
| ignore: | ||
| - "docs/" | ||
| - "test/" | ||
| - "**/test_*.py" | ||
| - "setup.py" | ||
| - "conftest.py" | ||
| - "README.md" | ||
| - "LICENSE" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| name: Run Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| workflow_dispatch: | ||
| # Allow manual triggering | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| test-type: ["integration"] | ||
| include: | ||
| - test-type: "integration" | ||
| pytest-args: "-m 'integration'" | ||
|
|
||
| services: | ||
| docker: | ||
| image: docker:dind | ||
| options: --privileged | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Python 3.12 | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Set up Docker Buildx | ||
| if: matrix.test-type == 'integration' | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Cache pip dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/.cache/pip | ||
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-pip- | ||
|
|
||
| - name: Install system dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential | ||
|
|
||
| - name: Install Python dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -r requirements.txt | ||
| pip install pytest pytest-cov pytest-mock pytest-asyncio | ||
|
|
||
| - name: Install package in development mode | ||
| run: | | ||
| pip install -e . | ||
|
|
||
| - name: Build Docker images for integration tests | ||
| if: matrix.test-type == 'integration' | ||
| run: | | ||
| # Build the shell server image needed for Docker tests | ||
| docker build -f src/microbots/environment/local_docker/image_builder/Dockerfile -t kavyasree261002/shell_server:latest . | ||
|
|
||
| - name: Run ${{ matrix.test-type }} tests | ||
| env: | ||
| # OpenAI API Configuration | ||
| OPEN_AI_KEY: ${{ secrets.OPEN_AI_KEY }} | ||
| OPEN_AI_DEPLOYMENT_NAME: ${{ secrets.OPEN_AI_DEPLOYMENT_NAME }} | ||
| OPEN_AI_END_POINT: ${{ secrets.OPEN_AI_END_POINT }} | ||
| # Azure OpenAI API Configuration | ||
| AZURE_OPENAI_API_VERSION: ${{ secrets.AZURE_OPENAI_API_VERSION }} | ||
| AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | ||
| AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }} | ||
| run: | | ||
| python -m pytest ${{ matrix.pytest-args }} \ | ||
| --cov=src \ | ||
| --cov-report=xml \ | ||
| --cov-report=term-missing \ | ||
| --junitxml=test-results-${{ matrix.test-type }}.xml \ | ||
| -v | ||
|
|
||
| - name: Upload test results | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: test-results-${{ matrix.test-type }} | ||
| path: test-results-*.xml | ||
|
|
||
| - name: Upload coverage reports | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: coverage-${{ matrix.test-type }} | ||
| path: coverage.xml | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v4 | ||
| if: always() | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| file: ./coverage.xml | ||
| flags: ${{ matrix.test-type }} | ||
| name: codecov-${{ matrix.test-type }} | ||
| fail_ci_if_error: false | ||
|
|
||
| test-summary: | ||
| runs-on: ubuntu-latest | ||
| needs: [test] | ||
| if: always() | ||
| steps: | ||
| - name: Download all test results | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: test-results-* | ||
| merge-multiple: true | ||
|
|
||
| - name: Test Summary | ||
| if: always() | ||
| run: | | ||
| echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Test Type | Status |" >> $GITHUB_STEP_SUMMARY | ||
| echo "|-----------|--------|" >> $GITHUB_STEP_SUMMARY | ||
| if [ "${{ needs.test.result }}" = "success" ]; then | ||
| echo "| Integration Tests | ✅ Passed |" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "| Integration Tests | ❌ Failed |" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,15 @@ | ||
| [tool:pytest] | ||
| testpaths = test | ||
| python_files = test_*.py | ||
| python_functions = test_* | ||
| addopts = | ||
| -v | ||
| --tb=short | ||
| --strict-markers | ||
|
|
||
| [pytest] | ||
| markers = | ||
| unit: Unit tests | ||
| integration: Integration tests | ||
| slow: Slow tests | ||
| docker: marks tests that require a running Docker daemon and pull container images | ||
|
|
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.