diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..4dc8a23a --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,32 @@ +name: Unit, integration, and notebook tests +#on: [push, pull_request] +on: [pull_request] + +jobs: + + build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'CI Bot')" + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.8 + uses: actions/setup-python@v3 + with: + python-version: "3.8" + - name: Check python version + run: python --version + - name: Install our dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install -r extra_requirements/dev-requirements.txt + - name: Run Docker Compose + run: docker compose -f deployment/compose.yml up -d + - name: Test with pytest + run: | + pytest + - name: Test notebooks + run: | + python flowcept/flowcept_webserver/app.py & + sleep 3 + pytest --nbmake "notebooks/" diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/test-python-310.yml similarity index 89% rename from .github/workflows/run-unit-tests.yml rename to .github/workflows/test-python-310.yml index 7f44f907..2f569675 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/test-python-310.yml @@ -1,6 +1,8 @@ -name: Unit Tests -#on: [push, pull_request] -on: [pull_request] +name: Test Python 3.10 +on: + pull_request: + #branches: [ "main" ] + branches: [ "dev" ] jobs: diff --git a/.github/workflows/test-python-39.yml b/.github/workflows/test-python-39.yml new file mode 100644 index 00000000..961d8f45 --- /dev/null +++ b/.github/workflows/test-python-39.yml @@ -0,0 +1,34 @@ +name: Test Python 3.9 +on: + pull_request: + #branches: [ "main" ] + branches: [ "dev" ] + +jobs: + + build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'CI Bot')" + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.9 + uses: actions/setup-python@v3 + with: + python-version: "3.9" + - name: Check python version + run: python --version + - name: Install our dependencies + run: | + python -m pip install --upgrade pip + pip install -e . + pip install -r extra_requirements/dev-requirements.txt + - name: Run Docker Compose + run: docker compose -f deployment/compose.yml up -d + - name: Test with pytest + run: | + pytest + - name: Test notebooks + run: | + python flowcept/flowcept_webserver/app.py & + sleep 3 + pytest --nbmake "notebooks/" diff --git a/extra_requirements/api-requirements.txt b/extra_requirements/api-requirements.txt deleted file mode 100644 index f2293605..00000000 --- a/extra_requirements/api-requirements.txt +++ /dev/null @@ -1 +0,0 @@ -requests diff --git a/extra_requirements/dev-requirements-mac.txt b/extra_requirements/dev-requirements-mac.txt deleted file mode 100644 index 780a0d7a..00000000 --- a/extra_requirements/dev-requirements-mac.txt +++ /dev/null @@ -1,9 +0,0 @@ -pytest==6.2.4 -flake8==5.0.4 -black==23.1.0 -numpy==1.23.4 -tensorboard==2.11.0 -tensorflow-macos==2.11.0 -bokeh==2.4.2 -jupyterlab==3.6.1 -nbmake==1.4 diff --git a/extra_requirements/dev-requirements.txt b/extra_requirements/dev-requirements.txt index c64d0d12..af23708b 100644 --- a/extra_requirements/dev-requirements.txt +++ b/extra_requirements/dev-requirements.txt @@ -2,8 +2,6 @@ pytest==6.2.4 flake8==5.0.4 black==23.1.0 numpy==1.23.4 -tensorboard==2.11.0 -tensorflow==2.11.0 bokeh==2.4.2 jupyterlab==3.6.1 nbmake==1.4 diff --git a/extra_requirements/tensorboard-requirements-mac.txt b/extra_requirements/tensorboard-requirements-mac.txt new file mode 100644 index 00000000..b4494615 --- /dev/null +++ b/extra_requirements/tensorboard-requirements-mac.txt @@ -0,0 +1,4 @@ +pandas==1.5.1 +tensorboard==2.11.0 +tensorflow-macos==2.11.0 +tbparse==0.0.7 diff --git a/extra_requirements/tensorboard-requirements.txt b/extra_requirements/tensorboard-requirements.txt index 2af05a73..d2b9bc5d 100644 --- a/extra_requirements/tensorboard-requirements.txt +++ b/extra_requirements/tensorboard-requirements.txt @@ -1,2 +1,4 @@ pandas==1.5.1 +tensorboard==2.11.0 +tensorflow==2.11.0 tbparse==0.0.7 diff --git a/extra_requirements/webserver-requirements.txt b/extra_requirements/webserver-requirements.txt index 19f5ec9c..d9d2b9b4 100644 --- a/extra_requirements/webserver-requirements.txt +++ b/extra_requirements/webserver-requirements.txt @@ -1 +1,3 @@ +flask==2.2.2 +requests==2.28.2 flask_restful==0.3.9 diff --git a/requirements.txt b/requirements.txt index bb0367a7..4f4d179d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,2 @@ -flask==2.2.2 -requests==2.28.2 PyYAML==6.0 redis==4.4.2 diff --git a/setup.py b/setup.py index 9a0b7c69..5d011fdb 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ from sys import platform +import os from setuptools import setup, find_packages with open("flowcept/version.py") as f: @@ -29,15 +30,20 @@ def get_requirements(file_path): "mongo", "dask", "webserver", - "api", ] -MAC_REQUIRES = [] +MAC_REQUIRES = ["tensorboard"] extras_requires = dict() for req in _EXTRA_REQUIREMENTS: if req in MAC_REQUIRES and platform == "darwin": req_path = f"extra_requirements/{req}-requirements-mac.txt" + # These env vars are needed to install tensorflow on mac + # (at least on m1 chip) + # (because of the grpcio package). See: + # https://stackoverflow.com/questions/66640705/how-can-i-install-grpcio-on-an-apple-m1-silicon-laptop + os.environ["GRPC_PYTHON_BUILD_SYSTEM_OPENSSL"] = "1" + os.environ["GRPC_PYTHON_BUILD_SYSTEM_ZLIB"] = "1" else: req_path = f"extra_requirements/{req}-requirements.txt" extras_requires[req] = get_requirements(req_path) @@ -62,16 +68,13 @@ def get_requirements(file_path): classifiers=[ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.8", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Natural Language :: English", - "Topic :: Documentation :: Sphinx", + # "Topic :: Documentation :: Sphinx", "Topic :: System :: Distributed Computing", ], - python_requires=">=3.10", # TODO: We don't really need py3.10, - # but if we change it now, - # we'll need to change CI/CD tests + python_requires=">=3.8", # scripts=["bin/flowcept"], ) diff --git a/tests/plugins/test_zambeze.py b/tests/plugins/test_zambeze.py index c50b487e..56865b7c 100644 --- a/tests/plugins/test_zambeze.py +++ b/tests/plugins/test_zambeze.py @@ -63,6 +63,7 @@ def test_send_message(self): ) self.logger.debug(" [x] Sent msg") + sleep(5) self._connection.close() sleep(10) doc_dao = DocumentDBDao()