feat: adding release and lint github actions

This commit is contained in:
ogabrielluiz 2023-03-07 13:08:12 -03:00
commit 94ffe2c02c
5 changed files with 1011 additions and 738 deletions

36
.github/workflows/lint.yml vendored Normal file
View file

@ -0,0 +1,36 @@
name: lint
on:
push:
branches: [main]
pull_request:
env:
POETRY_VERSION: "1.3.1"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==$POETRY_VERSION
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
- name: Install dependencies
run: |
poetry install
- name: Analysing the code with our lint
run: |
make lint

49
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,49 @@
name: release
on:
pull_request:
types:
- closed
branches:
- main
paths:
- "pyproject.toml"
env:
POETRY_VERSION: "1.3.1"
jobs:
if_release:
if: |
${{ github.event.pull_request.merged == true }}
&& ${{ contains(github.event.pull_request.labels.*.name, 'Release') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==$POETRY_VERSION
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "poetry"
- name: Build project for distribution
run: poetry build
- name: Check Version
id: check-version
run: |
echo version=$(poetry version --short) >> $GITHUB_OUTPUT
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
generateReleaseNotes: true
tag: v${{ steps.check-version.outputs.version }}
commit: master
- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry publish

18
Makefile Normal file
View file

@ -0,0 +1,18 @@
.PHONY: all format lint
all: help
format:
poetry run black .
poetry run ruff --select I --fix .
lint:
poetry run mypy .
poetry run black . --check
poetry run ruff .
help:
@echo '----'
@echo 'format - run code formatters'
@echo 'lint - run linters'

1639
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,12 +12,17 @@ exclude = ["langflow/frontend/node_modules/*", "langflow/frontend/src/*"]
[tool.poetry.scripts]
langflow = "langflow.cli:main"
[tool.poetry.group.dev.dependencies]
ruff = "^0.0.254"
black = "^23.1.0"
mypy = "^1.1.1"
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.dependencies]
python = "^3.10"
python = "^3.9"
openai = "^0.26.5"
fastapi = "^0.91.0"
uvicorn = "^0.20.0"