Skip to content

Commit

Permalink
fix(.github): Fix github action
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Apr 16, 2024
1 parent 3e35b7b commit 1fec67b
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 66 deletions.
132 changes: 70 additions & 62 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,70 +12,78 @@ jobs:
directory: [agents-api, model-serving, sdks/python]

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install and configure Poetry
uses: snok/install-poetry@v1

- name: Configure Poetry to use .venv
run: |
cd ${{ matrix.directory }}
poetry config virtualenvs.in-project true
- name: Cache Poetry virtualenv
uses: actions/cache@v3
with:
path: ${{ matrix.directory }}/.venv
key: ${{ runner.os }}-poetry-${{ matrix.directory }}-${{ hashFiles(format('{0}/poetry.lock', matrix.directory)) }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.directory }}-
- name: Install dependencies
run: |
cd ${{ matrix.directory }}
poetry install
- name: Lint and format
run: |
cd ${{ matrix.directory }}
poetry run poe check
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "refactor: Lint ${{ matrix.directory }} (CI)"
branch: ${{ github.head_ref }}
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install and configure Poetry
uses: snok/install-poetry@v1

- name: Configure Poetry to use .venv
run: |
cd ${{ matrix.directory }}
poetry config virtualenvs.in-project true
- name: Cache Poetry virtualenv
uses: actions/cache@v3
with:
path: ${{ matrix.directory }}/.venv
key: ${{ runner.os }}-poetry-${{ matrix.directory }}-${{ hashFiles(format('{0}/poetry.lock', matrix.directory)) }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.directory }}-
- name: Cache pytype
uses: actions/cache@v3
with:
path: ${{ matrix.directory }}/.pytype
key: ${{ runner.os }}-pytype-${{ matrix.directory }}-${{ hashFiles(format('{0}/**/*.py', matrix.directory)) }}
restore-keys: |
${{ runner.os }}-pytype-${{ matrix.directory }}-
- name: Install dependencies
run: |
cd ${{ matrix.directory }}
poetry install
- name: Lint and format
run: |
cd ${{ matrix.directory }}
poetry run poe check
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "refactor: Lint ${{ matrix.directory }} (CI)"
branch: ${{ github.head_ref }}

Lint-And-Format-TS-SDK:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '14.x'

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: sdks/ts/node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('sdks/ts/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Lint and format TypeScript SDK
run: |
cd sdks/ts
# npm ci
# npm run format
# npm run lint
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "refactor: Lint sdks/ts (CI)"
branch: ${{ github.head_ref }}
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20.x"

- name: Cache npm dependencies
uses: actions/cache@v3
with:
path: sdks/ts/node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('sdks/ts/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Lint and format TypeScript SDK
run: |
cd sdks/ts
npm ci
# npm run format
# npm run lint
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "refactor: Lint sdks/ts (CI)"
branch: ${{ github.head_ref }}
4 changes: 2 additions & 2 deletions agents-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ build-backend = "poetry.core.masonry.api"

[tool.poe.tasks]
format = "black ."
lint = "ruff **/*.py --fix --unsafe-fixes"
lint = "ruff agents_api/**/*.py migrations/**/*.py tests/**/*.py --fix --unsafe-fixes"
typecheck = "pytype agents_api"
check = [
"format",
"lint",
"typecheck",
]
test = "ward"
codegen = "datamodel-codegen --input ../openapi.yaml --input-file-type openapi --output agents_api/autogen/openapi_model.py --use-operation-id-as-name --use-double-quotes --use-schema-description --target-python-version 3.10 --reuse-model --collapse-root-models --use-field-description --field-include-all-keys --use-unique-items-as-set --use-subclass-enum --use-union-operator --use-one-literal-as-default --use-annotated --enum-field-as-literal one --output-model-type pydantic_v2.BaseModel"
codegen = "datamodel-codegen --input ../openapi.yaml --input-file-type openapi --output agents_api/autogen/openapi_model.py --use-operation-id-as-name --use-double-quotes --use-schema-description --target-python-version 3.10 --reuse-model --collapse-root-models --use-field-description --field-include-all-keys --use-unique-items-as-set --use-subclass-enum --use-union-operator --use-one-literal-as-default --use-annotated --enum-field-as-literal one --output-model-type pydantic_v2.BaseModel"
2 changes: 1 addition & 1 deletion model-serving/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poe.tasks]
prettify = "black ."
lint = "ruff **/*.py --fix --unsafe-fixes"
lint = "ruff model_api/**/*.py tests/**/*.py --fix --unsafe-fixes"
typecheck = "pytype model_api"
check = [
"prettify",
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poe.tasks]
format = "black ."
lint = "ruff **/*.py --fix --unsafe-fixes"
lint = "ruff julep/**/*.py tests/**/*.py --fix --unsafe-fixes"
typecheck = "pytype --config=pytype.toml julep"
check = [
"format",
Expand Down

0 comments on commit 1fec67b

Please sign in to comment.