Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
refactor: monorepo reorg (#739)
Browse files Browse the repository at this point in the history
* monorepo s01e01: move the adapter package

* monorepo s01e02: move fal modules to projects

* monorepo s01e03: fix action.yml paths

* monorepo s01e04: move fal tests to projects/fal

* monorepo s01e05: move fal integration tests to projects/fal

* monorepo s01e06: fix test workflows

* monorepo s01e07: move root pyproject to projects/fal

* monorepo s01e08: move root poetry.lock to projects/fal

* monorepo s01e09: fix path on poetry lock action

* monorepo s01e10: fix path on poetry lock action  oopsie

* monorepo s01e11: fix setup local fal action

* monorepo s01e12: fix readme file path

* monorepo s01e13: fix test docker path

* monorepo s01e14: fix test working directory

* monorepo s01e15: revert release action change

* monorepo s01e16: set working directory for run dbt step

* monorepo s01e17: fix environment paths

* monorepo s01e18: fix fal path lookup

* Poetry lock updated

* monorepo s01e19: fix copy-paste mistake... oops

* monorepo s01e20: fix project path lookup

* monorepo s01e21: project path resolve logging

* monorepo s01e22: fix project path resolution

* monorepo s01e23: removing prints... season finale

---------

Co-authored-by: drochetti <[email protected]>
  • Loading branch information
drochetti and drochetti authored Feb 3, 2023
1 parent b8a967e commit 4c29b70
Show file tree
Hide file tree
Showing 420 changed files with 47 additions and 48 deletions.
6 changes: 3 additions & 3 deletions .github/actions/setup-local-fal/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ runs:
if [[ '${{ inputs.adapter }}' == 'fal' ]]
then
pip install -e ./adapter[postgres]
pip install -e ./projects/adapter[postgres]
pip install dbt-postgres==${version}
else
echo "${package}==${version}"
Expand All @@ -65,9 +65,9 @@ runs:
run: |
if [[ '${{ inputs.adapter }}' == 'fal' ]]
then
pip install -e '.[postgres]'
pip install -e './projects/fal[postgres]'
else
pip install -e '.[${{ inputs.adapter }}]'
pip install -e './projects/fal[${{ inputs.adapter }}]'
fi
- name: List requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/poetry_lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
dir: [".", "adapter"]
dir: ["projects/fal", "projects/adapter"]

# Run only the latest commit pushed to PR
concurrency:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ jobs:
run: |
if [[ ${{ inputs.package }} == fal ]]
then
echo "PACKAGE_DIR=." >> $GITHUB_ENV
echo "PACKAGE_DIR=projects/fal" >> $GITHUB_ENV
echo "TAG_PREFIX=v" >> $GITHUB_ENV
elif [[ ${{ inputs.package }} == dbt-fal ]]
then
echo "PACKAGE_DIR=adapter" >> $GITHUB_ENV
echo "PACKAGE_DIR=projects/adapter" >> $GITHUB_ENV
echo "TAG_PREFIX=adapter-v" >> $GITHUB_ENV
fi
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/test_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ name: fal pytest
on:
pull_request:
types: [assigned, opened, synchronize, reopened]
paths-ignore:
- "examples/**"
- "docsite/**"
- "README.md"
- "LICENSE"
- "docker/**"
- "adapter/**"
- ".github/workflows/*adapter*"
paths:
- "projects/fal/**"
- ".github/**"
- "!.github/workflows/*adapter*"
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -42,16 +38,18 @@ jobs:
adapter: postgres

- name: Start Docker database
working-directory: tests
working-directory: projects/fal/tests
run: docker-compose up -d

- name: Setup pytest
run: pip install pytest pytest-mock mock black

- name: Run dbt
working-directory: projects/fal
run: dbt run --profiles-dir tests/mock/mockProfile/ --project-dir tests/mock

- name: Run tests
working-directory: projects/fal
env:
FAL_STATS_ENABLED: false
run: pytest tests -s
14 changes: 7 additions & 7 deletions .github/workflows/test_integration_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ on:
pull_request:
types: [assigned, opened, synchronize, reopened]
paths:
- "adapter/**"
- "projects/adapter/**"
- ".github/**"
- "!.github/workflows/*cli*"

push:
branches: [main]
paths:
- "adapter/**"
- "projects/adapter/**"

schedule:
# every midnight
Expand Down Expand Up @@ -60,17 +60,17 @@ jobs:
path: "fal"

- name: Start Docker database
working-directory: fal/integration_tests
working-directory: fal/projects/fal/integration_tests
if: contains(fromJSON('["postgres"]'), matrix.profile)
run: docker-compose up -d

- name: Start trino
working-directory: fal/adapter/integration_tests/configs/trino
working-directory: fal/projects/adapter/integration_tests/configs/trino
if: contains(fromJSON('["trino"]'), matrix.profile)
run: docker-compose up -d

- name: Setup latest dependencies
working-directory: fal/adapter/integration_tests
working-directory: fal/projects/adapter/integration_tests
run: |
python -m venv .venv
source .venv/bin/activate
Expand Down Expand Up @@ -103,12 +103,12 @@ jobs:
popd
- name: Setup behave
working-directory: fal/adapter/integration_tests
working-directory: fal/projects/adapter/integration_tests
run: pip install behave

- name: Run tests
id: test_run
working-directory: fal/adapter/integration_tests
working-directory: fal/projects/adapter/integration_tests
env:
FAL_STATS_ENABLED: false
# BigQuery
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/test_integration_cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ name: fal integration tests
on:
pull_request:
types: [assigned, opened, synchronize, reopened]
paths-ignore:
- "examples/**"
- "docsite/**"
- "README.md"
- "LICENSE"
- "docker/**"
- "adapter/**"
- ".github/workflows/*adapter*"
paths:
- "projects/fal/**"
- ".github/**"
- "!.github/workflows/*adapter*"

push:
branches: [main]
Expand Down Expand Up @@ -236,7 +232,7 @@ jobs:
adapter: ${{ matrix.profile }}

- name: Start Docker database
working-directory: integration_tests
working-directory: projects/fal/integration_tests
# TODO: make redshift use a real connection
if: contains(fromJSON('["redshift", "postgres", "fal"]'), matrix.profile)
run: docker-compose up -d
Expand All @@ -259,12 +255,12 @@ jobs:
conda-channels: anaconda, conda-forge

- name: Setup behave
working-directory: integration_tests
working-directory: projects/fal/integration_tests
run: pip install behave

- name: Run tests
id: test_run
working-directory: integration_tests
working-directory: projects/fal/integration_tests
env:
FAL_STATS_ENABLED: false
# BigQuery
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _get_dbt_packages(

branch_name = os.environ.get("FAL_GITHUB_BRANCH", "main")

dbt_fal_suffix = f" @ git+https://github.com/fal-ai/fal.git@{branch_name}#subdirectory=adapter"
dbt_fal_suffix = f" @ git+https://github.com/fal-ai/fal.git@{branch_name}#subdirectory=projects/adapter"
dbt_fal_version = None
else:
dbt_fal_path = _get_adapter_root_path()
Expand Down Expand Up @@ -319,7 +319,7 @@ def _get_adapter_root_path() -> Optional[Path]:
if (path.parent / ".git").exists():
break
path = path.parent
return path
return (path / "adapter")


def get_default_requirements(
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def set_project_folder(context, project: str):

if match:
project_number = match.group(1)
projects_dir = Path(__file__).parent.parent.parent / "projects"
projects_dir = _find_projects_directory()
found = [r.name for r in projects_dir.glob(project_number + "_*")]
if found:
extra = "Is it " + " or ".join(found) + " ?"
Expand Down Expand Up @@ -229,6 +229,11 @@ def check_model_results(context):
unittest.TestCase().assertCountEqual(models, expected_models)
_verify_node_order(context)

def _find_projects_directory():
path = Path(__file__)
while path is not None and not (path / "projects").exists():
path = path.parent
return (path / "projects")

def _verify_node_order(context):
import networkx as nx
Expand Down
Loading

0 comments on commit 4c29b70

Please sign in to comment.