Skip to content
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

Feature/setup GitHub actions #1

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
added smoke test
  • Loading branch information
waynehamadi committed Apr 15, 2023
commit 13879259fb944a566b9988176543073218772fc6
37 changes: 37 additions & 0 deletions .github/workflows/smoke_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Smoke Test

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.8]

steps:
- name: Check out repository
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Generate coverage report
run: |
coverage run --source=autogpt -m unittest tests/smoke_test.py
coverage report
coverage xml
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,7 @@ dmypy.json
# Pyre type checker
.pyre/
llama-*
vicuna-*
vicuna-*

# mac
.DS_Store
17 changes: 0 additions & 17 deletions tests/README.md

This file was deleted.

23 changes: 5 additions & 18 deletions tests/integration/test_commands.py → tests/smoke_test.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import contextlib
import os
import subprocess
import sys
import time
from pathlib import Path
import unittest
import platform

# Import necessary modules for testing, file operations, and handling system paths.

root_path = Path(__file__).resolve().parent.parent.parent
sys.path.append(str(root_path / 'scripts'))
from file_operations import read_file
from file_operations import delete_file
from autogpt.file_operations import delete_file, read_file

env_vars = {
'MEMORY_BACKEND': 'no_memory',
Expand All @@ -28,18 +19,15 @@ def test_write_file(self):

# Read the current ai_settings.yaml file and store its content.
ai_settings = None
with contextlib.suppress(Exception):
if os.path.exists('ai_settings.yaml'):
with open('ai_settings.yaml', 'r') as f:
ai_settings = f.read()
os.remove('ai_settings.yaml')

try:
with contextlib.suppress(Exception):
if os.path.exists('hello_world.txt'):
# Clean up any existing 'hello_world.txt' file before testing.
delete_file('hello_world.txt')

# Remove ai_settings.yaml file to avoid continuing from the previous session.
os.remove('ai_settings.yaml')

# Prepare input data for the test.
input_data = '''write_file-GPT
an AI designed to use the write_file command to write 'Hello World' into a file named "hello_world.txt" and then use the task_complete command to complete the task.
Expand All @@ -49,8 +37,7 @@ def test_write_file(self):

y -5
EOF'''
script_path = root_path / 'scripts' / 'main.py'
command = f'{sys.executable} {script_path}'
command = f'{sys.executable} -m autogpt'

# Execute the script with the input data.
process = subprocess.Popen(command, stdin=subprocess.PIPE, shell=True, env={**os.environ, **env_vars})
Expand Down
10 changes: 0 additions & 10 deletions tests/unit/json_tests.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import unittest
<<<<<<< HEAD

from autogpt.json_parser import fix_and_parse_json
=======
import os
import sys
from pathlib import Path

# Probably a better way:
sys.path.append(str(Path(__file__).resolve().parent.parent.parent / 'scripts'))
from json_parser import fix_and_parse_json
>>>>>>> 27e0703d (Update sys.path to use pathlib in json_tests.py)


class TestParseJson(unittest.TestCase):
Expand Down