Skip to content

Commit

Permalink
poetry actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bowenliang123 committed Jun 12, 2024
1 parent b7c72f7 commit aee2072
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 16 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/api-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ concurrency:

jobs:
test:
name: API Tests
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -81,6 +80,7 @@ jobs:
run: dev/pytest/pytest_vdb.sh

test-in-poetry:
name: API Tests
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -89,26 +89,26 @@ jobs:
- "3.11"

steps:
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.1"

- name: Checkout code
uses: actions/checkout@v4

- name: Install Poetry
uses: abatilo/actions-poetry@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
cache-dependency-path: ./api/poetry.lock
cache-dependency-path: |
api/pyproject.toml
api/poetry.lock
- name: Poetry check
run: poetry check -C api

- name: Install dependencies
run: poetry install -C api
run: poetry install -C api --with dev

- name: Run Unit tests
run: poetry run -C api bash dev/pytest/pytest_unit_tests.sh
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/db-migration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Poetry
uses: abatilo/actions-poetry@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache: 'poetry'
cache-dependency-path: |
./api/requirements.txt
api/pyproject.toml
api/poetry.lock
- name: Install dependencies
run: pip install -r ./api/requirements.txt
run: poetry install -C api

- name: Set up Middleware
uses: hoverkraft-tech/[email protected]
Expand All @@ -50,4 +54,4 @@ jobs:
- name: Run DB Migration
run: |
cd api
flask db upgrade
poetry run python -m flask db upgrade
9 changes: 6 additions & 3 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
with:
files: api/**

- name: Install Poetry
uses: abatilo/actions-poetry@v3

- name: Set up Python
uses: actions/setup-python@v5
if: steps.changed-files.outputs.any_changed == 'true'
Expand All @@ -32,15 +35,15 @@ jobs:

- name: Python dependencies
if: steps.changed-files.outputs.any_changed == 'true'
run: pip install ruff dotenv-linter
run: poetry install -C api --only lint

- name: Ruff check
if: steps.changed-files.outputs.any_changed == 'true'
run: ruff check --preview ./api
run: poetry run -C api ruff check --preview ./api

- name: Dotenv check
if: steps.changed-files.outputs.any_changed == 'true'
run: dotenv-linter ./api/.env.example ./web/.env.example
run: poetry run -C api dotenv-linter ./api/.env.example ./web/.env.example

- name: Lint hints
if: failure()
Expand Down
1 change: 1 addition & 0 deletions api/migrations/README
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Single-database configuration for Flask.

74 changes: 73 additions & 1 deletion api/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,20 @@ google-cloud-aiplatform = "1.49.0"
vanna = {version = "0.5.5", extras = ["postgres", "mysql", "clickhouse", "duckdb"]}
kaleido = "0.2.1"

[tool.poetry.group.dev]
optional = true

[tool.poetry.group.dev.dependencies]
coverage = "~7.2.4"
pytest = "~8.1.1"
pytest-benchmark = "~4.0.0"
pytest-env = "~1.1.3"
pytest-mock = "~3.14.0"

[tool.poetry.group.lint]
optional = true

[tool.poetry.group.lint.dependencies]
ruff = "~0.4.8"
dotenv-linter = "~0.5.0"

0 comments on commit aee2072

Please sign in to comment.