Skip to content

Commit

Permalink
fix(poetry): update build scripts for ci environment
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineDao committed May 12, 2024
1 parent aab0bae commit 5db2bd3
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 29 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
bash scripts/install-poetry.sh
poetry install
- name: run tests
run: python -m pytest --cov=queenbee tests/
run: poetry run pytest --cov=queenbee tests/
- name: run test coverage
run: |
echo "Coveralls is no longer supported"
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: install semantic-release
run: npm install @semantic-release/exec
- name: generate queenbee schemas
run: python scripts/gen_schemas.py
run: poetry run python3 scripts/gen_schemas.py
- name: run semantic release
id: new_release
run: |
Expand Down Expand Up @@ -82,9 +82,9 @@ jobs:
poetry install --extras cli
- name: build docs
run: |
python gen_schemas.py --version ${{needs.deploy.outputs.tag}}
sphinx-apidoc -f -e -d 4 -o ./docs/modules ./queenbee
sphinx-build -b html ./docs ./docs/_build
poetry run python3 scripts/gen_schemas.py --version ${{needs.deploy.outputs.tag}}
poetry run sphinx-apidoc -f -e -d 4 -o ./docs/modules ./queenbee
poetry run sphinx-build -b html ./docs ./docs/_build
- name: deploy to github pages
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
[
"@semantic-release/exec",
{
"prepareCmd": "python scripts/gen_schemas.py --version ${nextRelease.version}",
"prepareCmd": "poetry run python3 scripts/gen_schemas.py --version ${nextRelease.version}",
"publishCmd": "bash scripts/deploy.sh"
}
]
Expand Down
32 changes: 19 additions & 13 deletions poetry.lock

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

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ packages = [
[tool.poetry.scripts]
queenbee = 'queenbee.cli:main'


[tool.poetry.dependencies]
python = "^3.7"
pydantic = "<2.0"
pyyaml = ">=6.0"
jsonschema = ">=4.17.3"
click = "^8.1.7"
click-plugins = "^1.1.1"

[tool.poetry.extras]
cli = ["click", "click_plugins"]
Expand Down
23 changes: 14 additions & 9 deletions scripts/gen_schemas.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
"""A module to generate OpenAPI and JSONSchemas."""

import argparse
import json
import os
import argparse

from pkg_resources import get_distribution

from pydantic_openapi_helper.core import get_openapi
from pydantic_openapi_helper.inheritance import class_mapper

from queenbee.repository import RepositoryIndex
from queenbee.job import Job, JobStatus, RunStatus
from queenbee.recipe import Recipe, RecipeInterface
from queenbee.plugin import Plugin
from queenbee.recipe import Recipe, RecipeInterface
from queenbee.repository import RepositoryIndex

folder = os.path.join(os.path.dirname(__file__), 'docs/_static/schemas')
folder = os.path.join(os.path.dirname(__file__), '../docs/_static/schemas')
if not os.path.isdir(folder):
os.mkdir(folder)


parser = argparse.ArgumentParser(description='Generate OpenAPI JSON schemas')

parser.add_argument('--version', help='Set the version of the new OpenAPI Schema')
parser.add_argument(
'--version', help='Set the version of the new OpenAPI Schema')

args = parser.parse_args()

Expand Down Expand Up @@ -52,7 +52,8 @@
with open(os.path.join(folder, 'job-openapi.json'), 'w') as out_file:
json.dump(
get_openapi(
base_object=[Job, JobStatus, RunStatus], title='Queenbee Job Schema',
base_object=[Job, JobStatus,
RunStatus], title='Queenbee Job Schema',
description='Schema documentation for Queenbee Jobs',
version=VERSION
),
Expand Down Expand Up @@ -95,10 +96,13 @@


with open(os.path.join(folder, 'job-schemas-combined.json'), 'w') as out_file:
from typing import List, Union

from pydantic import BaseModel

from queenbee.io.inputs.step import StepInputs
from queenbee.io.outputs.step import StepOutputs
from typing import List, Union

class JobSchemas(BaseModel):
job: Job
job_status: JobStatus
Expand Down Expand Up @@ -132,7 +136,8 @@ class JobSchemas(BaseModel):
"url": "./queenbee_inheritance.json"
}

models = [Recipe, Plugin, Job, RepositoryIndex, RecipeInterface, JobStatus, RunStatus]
models = [Recipe, Plugin, Job, RepositoryIndex,
RecipeInterface, JobStatus, RunStatus]
openapi = get_openapi(
models,
title='Queenbee Schema',
Expand Down

0 comments on commit 5db2bd3

Please sign in to comment.