Skip to content

Commit

Permalink
Tr/making the tests great (#50)
Browse files Browse the repository at this point in the history
* Add initial files for GitHub User Finder js example project

* chore: Rename package.json and update project name to js-vanilla-example

* chore: Update project name to js-vanilla-example

* s1

* s1

* s1

* Added Makefile for simpler operations and incremented version.

* Cleaned up CI script with Makefile.

* Initial boiler plate commit of basic integration test.

* s1

* s1

* s1

* s1

* prompts

* Updated workflow to account for makefile release.

---------

Co-authored-by: Omri Grossman <[email protected]>
Co-authored-by: Embedded DevOps <[email protected]>
  • Loading branch information
3 people authored May 28, 2024
1 parent 3b09281 commit 252a89c
Show file tree
Hide file tree
Showing 22 changed files with 615 additions and 240 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/ci_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
- name: Run tests and generate reports
env:
OPENAI_API_KEY: "This_is_a_fake_API_key"
run: |
poetry run pytest --junitxml=testLog.xml --cov=cover_agent --cov-report=xml:cobertura.xml --cov-report=term --cov-fail-under=70 --log-cli-level=INFO
run: make test
- name: Upload test report
uses: actions/upload-artifact@v2
if: always()
Expand Down Expand Up @@ -96,32 +95,40 @@ jobs:
pip install poetry
poetry install
- name: Build Executable
run: |
poetry run pyinstaller --add-data "cover_agent/version.txt:." --add-data "cover_agent/settings/language_extensions.toml:." --add-data "cover_agent/settings/test_generation_prompt.toml:." --hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext --onefile --name cover-agent-${{ matrix.os }} cover_agent/main.py
run: make installer
- name: Test Executable (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: .\dist\cover-agent-${{ matrix.os }}.exe --help
run: .\dist\cover-agent.exe --help
shell: pwsh
- name: Test Executable (Unix)
if: ${{ matrix.os != 'windows-latest' }}
run: ./dist/cover-agent-${{ matrix.os }} --help
run: ./dist/cover-agent --help
shell: bash
- name: Upload Executable
uses: actions/upload-artifact@v2
with:
name: cover-agent-${{ matrix.os }}
path: dist/cover-agent-${{ matrix.os }}*
path: dist/cover-agent*

release:
needs: [build, changes]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.changes.outputs.version_changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download executables
- name: Download executables (Ubuntu)
uses: actions/download-artifact@v2
with:
path: dist
name: cover-agent-ubuntu-latest
path: dist/ubuntu-latest
- uses: actions/download-artifact@v2
with:
name: cover-agent-windows-latest
path: dist/windows-latest
- uses: actions/download-artifact@v2
with:
name: cover-agent-macos-latest
path: dist/macos-latest
- name: Extract version
run: |
echo "VERSION=$(cat cover_agent/version.txt)" >> $GITHUB_ENV
Expand All @@ -141,7 +148,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/cover-agent-ubuntu-latest/cover-agent-ubuntu-latest
asset_path: dist/ubuntu-latest/cover-agent
asset_name: cover-agent-ubuntu
asset_content_type: application/octet-stream
- name: Upload Release Asset (Windows)
Expand All @@ -150,7 +157,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/cover-agent-windows-latest/cover-agent-windows-latest.exe
asset_path: dist/windows-latest/cover-agent.exe
asset_name: cover-agent-windows.exe
asset_content_type: application/octet-stream
- name: Upload Release Asset (macOS)
Expand All @@ -159,6 +166,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/cover-agent-macos-latest/cover-agent-macos-latest
asset_path: dist/macos-latest/cover-agent
asset_name: cover-agent-macos
asset_content_type: application/octet-stream
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Makefile

.PHONY: test build installer

test:
poetry run pytest --junitxml=testLog.xml --cov=cover_agent --cov-report=xml:cobertura.xml --cov-report=term --cov-fail-under=70 --log-cli-level=INFO

build:
poetry build

installer:
poetry run pyinstaller --add-data "cover_agent/version.txt:." --add-data "cover_agent/settings/language_extensions.toml:." --add-data "cover_agent/settings/test_generation_prompt.toml:." --hidden-import=tiktoken_ext.openai_public --hidden-import=tiktoken_ext --onefile --name cover-agent cover_agent/main.py
3 changes: 3 additions & 0 deletions cover_agent/PromptBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def __init__(
self.source_file_numbered = "\n".join(
[f"{i+1} {line}" for i, line in enumerate(self.source_file.split("\n"))]
)
self.test_file_numbered = "\n".join(
[f"{i+1} {line}" for i, line in enumerate(self.test_file.split("\n"))])

# Conditionally fill in optional sections
self.included_files = (
Expand Down Expand Up @@ -125,6 +127,7 @@ def build_prompt(self) -> dict:
"source_file_name": self.source_file_name,
"test_file_name": self.test_file_name,
"source_file_numbered": self.source_file_numbered,
"test_file_numbered": self.test_file_numbered,
"source_file": self.source_file,
"test_file": self.test_file,
"code_coverage_report": self.code_coverage_report,
Expand Down
Loading

0 comments on commit 252a89c

Please sign in to comment.