Skip to content

Commit

Permalink
Set up a CD pipeline (#1)
Browse files Browse the repository at this point in the history
* Set up CD pipeline

* format code

* add tests

---------

Co-authored-by: Yazhou Cao <[email protected]>
  • Loading branch information
humpydonkey and AsiaCao authored Feb 13, 2024
1 parent 52b2384 commit 8b32203
Show file tree
Hide file tree
Showing 10 changed files with 1,760 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
extend-ignore = E501,E203
max-line-length = 88
max-complexity = 15
per-file-ignores = __init__.py:F401
84 changes: 84 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
Test:
strategy:
matrix:
python-version: [3.8, 3.10.11]
os: [ ubuntu-22.04, windows-2022, macos-12 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Python Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.4.2
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true
- name: Print Python environment information
run: |
poetry env info
poetry --version
poetry run pip -V
- name: Install dependencies
run: |
# Install main dependencies first so we can see their size
poetry install --all-extras
- name: Linting
run: |
# stop the build if there are Python syntax errors or undefined names
poetry run flake8 . --exclude .venv --count --show-source --statistics
- name: Check Format
run: |
poetry run black --check --diff --color .
- name: Type Checking
run: |
poetry run mypy lmm_tools
- name: Test with pytest
run: |
poetry run pytest -v tests
Release:
needs: Test
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') && !contains(github.event.head_commit.message, '[skip release]')
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
with:
python-version: 3.10.11
- name: Install Python Poetry
uses: abatilo/[email protected]
with:
poetry-version: 1.4.2
- name: Configure poetry
shell: bash
run: poetry config virtualenvs.in-project true
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}
- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: Bump up version
run: |
poetry version patch
git add pyproject.toml
new_version=`poetry version`
git commit -m "[skip ci] chore(release): ${new_version}"
git push -f
- name: Publish to PyPI
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish --build -vvv
52 changes: 52 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: pdoc

# build the documentation whenever there are new commits on main
on:
push:
branches:
- main
# Alternative: only build for tags.
# tags:
# - '*'

# security: restrict permissions for CI jobs.
permissions:
contents: read

jobs:
# Build the documentation and upload the static HTML files as an artifact.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.10.11

- uses: Gr1N/setup-poetry@v8
with:
poetry-version: "1.2.2"

- run: poetry install --all-extras
- run: mkdir -p docs-build
#- run: poetry run pdoc -t pdocs/templates --docformat=numpy -o docs-build landingai
- run: poetry run mkdocs build -f mkdocs.yml -d docs-build/

- uses: actions/upload-pages-artifact@v1
with:
path: docs-build/

# Deploy the artifact to GitHub pages.
# This is a separate job so that only actions/deploy-pages has the necessary permissions.
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v2
94 changes: 94 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Env files
.env

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su

# Mac files
.DS_Store
.DS_STORE

# Old HG stuff
.hg
.hgignore
.hgtags

.git
__pycache__
.ipynb_checkpoints
*/__pycache__
*/.ipynb_checkpoints
.local
.jupyter
.ipython
*/.terraform
terraform.*
.terraform.*
shinobi-dvr/*
.vscode/

# mypy
.mypy_cache/*

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Output from various tools
examples/output
tests/output
docs-build

# Local or WIP files
local/
17 changes: 17 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p align="center">
<img width="100" height="100" src="https://github.com/landing-ai/landingai-python/raw/main/assets/avi-logo.png">
</p>

# Welcome to the Landing AI LMM Tools Documentation

This library provides a set of tools to help you build applications with Large Multimodal Model (LMM).


## Quick Start

### Install
First, install the library:

```bash
pip install lmm-tools
```
Empty file added lmm_tools/__init__.py
Empty file.
2 changes: 2 additions & 0 deletions lmm_tools/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
if __name__ == "__main__":
print("Hello, World!")
Loading

0 comments on commit 8b32203

Please sign in to comment.