Skip to content

Commit

Permalink
chore: updating CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayvammi committed Dec 24, 2024
1 parent 0132c39 commit 76edc83
Show file tree
Hide file tree
Showing 17 changed files with 174 additions and 323 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- run: python -m pip install poetry
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: "Set up Python"
run: uv python install
- run: |
python -m poetry install --only docs
poetry run mkdocs gh-deploy --force
uv sync --only-group docs
uv run mkdocs gh-deploy --force
8 changes: 1 addition & 7 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.8
- run: python -m pip install poetry
- run: |
# Download the binary
curl -sLO https://github.com/argoproj/argo-workflows/releases/download/v3.5.4/argo-linux-amd64.gz
Expand All @@ -39,9 +35,7 @@ jobs:
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
run: uv python install

- name: Install the project
run: uv sync --all-extras --dev
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.9
- run: python -m pip install poetry
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: "Set up Python"
run: uv python install
- run: |
uv sync --only-group release
- name: Figure version
continue-on-error: true
env:
Expand Down
2 changes: 1 addition & 1 deletion tests/extensions/catalog/test_catalog_extension.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from extensions.catalog import is_catalog_out_of_sync
from runnable.catalog import is_catalog_out_of_sync


def test_is_catalog_out_of_sync_returns_true_for_empty_synced_catalogs():
Expand Down
81 changes: 37 additions & 44 deletions tests/extensions/catalog/test_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import pytest

import extensions.catalog.file_system as implementation
from extensions.catalog.file_system.implementation import FileSystemCatalog
from extensions.catalog import file_system as module
from extensions.catalog.file_system import FileSystemCatalog
from runnable import defaults


Expand Down Expand Up @@ -38,7 +38,7 @@ def mock_does_dir_exist(dir_name):
return True
return False

monkeypatch.setattr(implementation.utils, "does_dir_exist", mock_does_dir_exist)
monkeypatch.setattr(module.utils, "does_dir_exist", mock_does_dir_exist)

catalog_handler = FileSystemCatalog(catalog_location="this_location")
with pytest.raises(Exception, match="Expected Catalog to be present at"):
Expand All @@ -62,13 +62,13 @@ def test_file_system_catalog_get_copies_files_from_catalog_to_compute_folder_wit

with tempfile.TemporaryDirectory() as catalog_location:
with tempfile.TemporaryDirectory(dir=".") as compute_folder:
catalog_location_path = implementation.Path(catalog_location)
catalog_location_path = module.Path(catalog_location)
run_id = "testing"
implementation.Path(catalog_location_path / run_id / compute_folder).mkdir(
module.Path(catalog_location_path / run_id / compute_folder).mkdir(
parents=True
)
with open(
implementation.Path(catalog_location)
module.Path(catalog_location)
/ run_id
/ compute_folder
/ "catalog_file",
Expand Down Expand Up @@ -101,13 +101,13 @@ def test_file_system_catalog_get_copies_files_from_catalog_to_compute_folder_wit

with tempfile.TemporaryDirectory() as catalog_location:
with tempfile.TemporaryDirectory(dir=".") as compute_folder:
catalog_location_path = implementation.Path(catalog_location)
catalog_location_path = module.Path(catalog_location)
run_id = "testing"
implementation.Path(catalog_location_path / run_id / compute_folder).mkdir(
module.Path(catalog_location_path / run_id / compute_folder).mkdir(
parents=True
)
with open(
implementation.Path(catalog_location)
module.Path(catalog_location)
/ run_id
/ compute_folder
/ "catalog_file",
Expand All @@ -116,10 +116,7 @@ def test_file_system_catalog_get_copies_files_from_catalog_to_compute_folder_wit
fw.write("hello")

with open(
implementation.Path(catalog_location)
/ run_id
/ compute_folder
/ "not_catalog",
module.Path(catalog_location) / run_id / compute_folder / "not_catalog",
"w",
) as fw:
fw.write("hello")
Expand All @@ -136,7 +133,7 @@ def test_file_system_catalog_put_copies_files_from_compute_folder_to_catalog_if_
mocker, monkeypatch
):
monkeypatch.setattr(
implementation, "is_catalog_out_of_sync", mocker.MagicMock(return_value=True)
module, "is_catalog_out_of_sync", mocker.MagicMock(return_value=True)
)
mock_run_store = mocker.MagicMock()
mock_context = mocker.MagicMock()
Expand All @@ -150,11 +147,11 @@ def test_file_system_catalog_put_copies_files_from_compute_folder_to_catalog_if_

with tempfile.TemporaryDirectory() as catalog_location:
with tempfile.TemporaryDirectory(dir=".") as compute_folder:
catalog_location_path = implementation.Path(catalog_location)
catalog_location_path = module.Path(catalog_location)
run_id = "testing"
implementation.Path(catalog_location_path / run_id).mkdir(parents=True)
module.Path(catalog_location_path / run_id).mkdir(parents=True)

with open(implementation.Path(compute_folder) / "catalog_file", "w") as fw:
with open(module.Path(compute_folder) / "catalog_file", "w") as fw:
fw.write("hello")

catalog_handler = FileSystemCatalog(catalog_location=catalog_location)
Expand All @@ -169,7 +166,7 @@ def test_file_system_catalog_put_copies_files_from_compute_folder_to_catalog_if_
mocker, monkeypatch
):
monkeypatch.setattr(
implementation, "is_catalog_out_of_sync", mocker.MagicMock(return_value=True)
module, "is_catalog_out_of_sync", mocker.MagicMock(return_value=True)
)
mock_run_store = mocker.MagicMock()
mock_context = mocker.MagicMock()
Expand All @@ -182,15 +179,13 @@ def test_file_system_catalog_put_copies_files_from_compute_folder_to_catalog_if_
)
with tempfile.TemporaryDirectory() as catalog_location:
with tempfile.TemporaryDirectory(dir=".") as compute_folder:
catalog_location_path = implementation.Path(catalog_location)
catalog_location_path = module.Path(catalog_location)
run_id = "testing"
implementation.Path(catalog_location_path / run_id).mkdir(parents=True)
with open(implementation.Path(compute_folder) / "catalog_file", "w") as fw:
module.Path(catalog_location_path / run_id).mkdir(parents=True)
with open(module.Path(compute_folder) / "catalog_file", "w") as fw:
fw.write("hello")

with open(
implementation.Path(compute_folder) / "not_catalog_file", "w"
) as fw:
with open(module.Path(compute_folder) / "not_catalog_file", "w") as fw:
fw.write("hello")

catalog_handler = FileSystemCatalog(catalog_location=catalog_location)
Expand All @@ -206,7 +201,7 @@ def test_file_system_catalog_put_copies_files_from_compute_folder_to_catalog_if_
mocker, monkeypatch
):
monkeypatch.setattr(
implementation, "is_catalog_out_of_sync", mocker.MagicMock(return_value=False)
module, "is_catalog_out_of_sync", mocker.MagicMock(return_value=False)
)
mock_run_store = mocker.MagicMock()
mock_context = mocker.MagicMock()
Expand All @@ -220,15 +215,13 @@ def test_file_system_catalog_put_copies_files_from_compute_folder_to_catalog_if_

with tempfile.TemporaryDirectory() as catalog_location:
with tempfile.TemporaryDirectory(dir=".") as compute_folder:
catalog_location_path = implementation.Path(catalog_location)
catalog_location_path = module.Path(catalog_location)
run_id = "testing"
implementation.Path(catalog_location_path / run_id).mkdir(parents=True)
with open(implementation.Path(compute_folder) / "catalog_file", "w") as fw:
module.Path(catalog_location_path / run_id).mkdir(parents=True)
with open(module.Path(compute_folder) / "catalog_file", "w") as fw:
fw.write("hello")

with open(
implementation.Path(compute_folder) / "not_catalog_file", "w"
) as fw:
with open(module.Path(compute_folder) / "not_catalog_file", "w") as fw:
fw.write("hello")

catalog_handler = FileSystemCatalog(catalog_location=catalog_location)
Expand All @@ -242,42 +235,42 @@ def test_file_system_catalog_put_copies_files_from_compute_folder_to_catalog_if_

def test_file_system_catalog_put_uses_compute_folder_by_default(monkeypatch, mocker):
mock_safe_make_dir = mocker.MagicMock()
monkeypatch.setattr(implementation.utils, "safe_make_dir", mock_safe_make_dir)
monkeypatch.setattr(module.utils, "safe_make_dir", mock_safe_make_dir)

mock_does_dir_exist = mocker.MagicMock(side_effect=Exception())
monkeypatch.setattr(implementation.utils, "does_dir_exist", mock_does_dir_exist)
monkeypatch.setattr(module.utils, "does_dir_exist", mock_does_dir_exist)

catalog_handler = FileSystemCatalog(catalog_location="this_location")
with pytest.raises(Exception):
catalog_handler.put("testing", run_id="dummy_run_id")

mock_does_dir_exist.assert_called_once_with(implementation.Path("."))
mock_does_dir_exist.assert_called_once_with(module.Path("."))


def test_file_system_catalog_put_uses_compute_folder_provided(monkeypatch, mocker):
mock_safe_make_dir = mocker.MagicMock()
monkeypatch.setattr(implementation.utils, "safe_make_dir", mock_safe_make_dir)
monkeypatch.setattr(module.utils, "safe_make_dir", mock_safe_make_dir)

mock_does_dir_exist = mocker.MagicMock(side_effect=Exception())
monkeypatch.setattr(implementation.utils, "does_dir_exist", mock_does_dir_exist)
monkeypatch.setattr(module.utils, "does_dir_exist", mock_does_dir_exist)

catalog_handler = FileSystemCatalog(catalog_location="this_location")
with pytest.raises(Exception):
catalog_handler.put(
"testing", run_id="dummy_run_id", compute_data_folder="not_data"
)

mock_does_dir_exist.assert_called_once_with(implementation.Path("not_data"))
mock_does_dir_exist.assert_called_once_with(module.Path("not_data"))


def test_file_system_catalog_put_raises_exception_if_compute_data_folder_does_not_exist(
monkeypatch, mocker
):
mock_safe_make_dir = mocker.MagicMock()
monkeypatch.setattr(implementation.utils, "safe_make_dir", mock_safe_make_dir)
monkeypatch.setattr(module.utils, "safe_make_dir", mock_safe_make_dir)

mock_does_dir_exist = mocker.MagicMock(return_value=False)
monkeypatch.setattr(implementation.utils, "does_dir_exist", mock_does_dir_exist)
monkeypatch.setattr(module.utils, "does_dir_exist", mock_does_dir_exist)

catalog_handler = FileSystemCatalog(catalog_location="this_location")
with pytest.raises(Exception):
Expand All @@ -290,29 +283,29 @@ def test_file_system_catalog_put_creates_catalog_location_using_run_id(
monkeypatch, mocker
):
mock_safe_make_dir = mocker.MagicMock()
monkeypatch.setattr(implementation.utils, "safe_make_dir", mock_safe_make_dir)
monkeypatch.setattr(module.utils, "safe_make_dir", mock_safe_make_dir)

mock_does_dir_exist = mocker.MagicMock(side_effect=Exception())
monkeypatch.setattr(implementation.utils, "does_dir_exist", mock_does_dir_exist)
monkeypatch.setattr(module.utils, "does_dir_exist", mock_does_dir_exist)

catalog_handler = FileSystemCatalog(catalog_location="this_location")

with pytest.raises(Exception):
catalog_handler.put("testing", run_id="dummy_run_id")

mock_safe_make_dir.assert_called_once_with(
implementation.Path("this_location") / "dummy_run_id"
module.Path("this_location") / "dummy_run_id"
)


def test_file_system_sync_between_runs_raises_exception_if_previous_catalog_does_not_exist(
monkeypatch, mocker
):
mock_safe_make_dir = mocker.MagicMock()
monkeypatch.setattr(implementation.utils, "safe_make_dir", mock_safe_make_dir)
monkeypatch.setattr(module.utils, "safe_make_dir", mock_safe_make_dir)

mock_does_dir_exist = mocker.MagicMock(return_value=False)
monkeypatch.setattr(implementation.utils, "does_dir_exist", mock_does_dir_exist)
monkeypatch.setattr(module.utils, "does_dir_exist", mock_does_dir_exist)

catalog_handler = FileSystemCatalog(catalog_location="this_location")
with pytest.raises(Exception):
Expand Down
11 changes: 0 additions & 11 deletions tests/extensions/catalog/test_k8s_pvc.py

This file was deleted.

21 changes: 0 additions & 21 deletions tests/extensions/catalog/test_k8s_pvc_integration.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/extensions/executor/test_argo_executor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from runnable.extensions.executor.argo import implementation
from extensions.executor import argo as implementation


def test_secret_env_var_has_value_from_field():
Expand Down
Loading

0 comments on commit 76edc83

Please sign in to comment.