Skip to content

Commit

Permalink
Use monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
amh4r committed Feb 10, 2025
1 parent bdbcf1f commit b37ca72
Show file tree
Hide file tree
Showing 221 changed files with 2,425 additions and 476 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/ci.yml → .github/workflows/inngest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Python CI"
name: "inngest"

on:
push:
Expand All @@ -8,31 +8,15 @@ on:
- "*"
pull_request:
paths:
- "**/*.py"
- ".github/**"
- "Makefile"
- "constraints.txt"
- "examples/**"
- "inngest/**"
- "pyproject.toml"
- "tests/**"
- "pytest.ini"
- "ruff.toml"

jobs:
format-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Format check"
run: "make format-check"

itest:
runs-on: "ubuntu-latest"
strategy:
Expand All @@ -49,6 +33,7 @@ jobs:
run: "make install"
- name: "Integration test"
run: "make itest"
working-directory: "./pkg/inngest"

lint:
runs-on: "ubuntu-latest"
Expand All @@ -65,19 +50,19 @@ jobs:
run: "make install"
- name: "Lint"
run: "make lint"
working-directory: "./pkg/inngest"

publish-pypi:
runs-on: "ubuntu-latest"
needs:
- "format-check"
- "itest"
- "lint"
- "type-check"
- "utest"

# Only publish tagged versions.
# TODO: Add a check to ensure that the git tag matches the version.
if: "startsWith(github.ref, 'refs/tags/')"
if: "startsWith(github.ref, 'refs/tags/inngest@')"
permissions:
id-token: write
strategy:
Expand All @@ -93,6 +78,7 @@ jobs:
run: "make install"
- name: "Install"
run: "make build"
working-directory: "./pkg/inngest"
- name: "Upload package to PyPI"
uses: "pypa/gh-action-pypi-publish@release/v1"

Expand All @@ -111,6 +97,7 @@ jobs:
run: "make install"
- name: "Type check"
run: "make type-check"
working-directory: "./pkg/inngest"

utest:
runs-on: "ubuntu-latest"
Expand All @@ -127,3 +114,4 @@ jobs:
run: "make install"
- name: "Unit test"
run: "make utest"
working-directory: "./pkg/inngest"
117 changes: 117 additions & 0 deletions .github/workflows/inngest_encryption.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: "inngest_encryption"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
paths:
- "**/*.py"
- ".github/**"
- "Makefile"
- "constraints.txt"
- "pyproject.toml"
- "pytest.ini"
- "ruff.toml"

jobs:
itest:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
timeout-minutes: 2
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Integration test"
run: "make itest"
working-directory: "./pkg/inngest_encryption"

lint:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Lint"
run: "make lint"
working-directory: "./pkg/inngest_encryption"

publish-pypi:
runs-on: "ubuntu-latest"
needs:
- "itest"
- "lint"
- "type-check"
- "utest"

# Only publish tagged versions.
# TODO: Add a check to ensure that the git tag matches the version.
if: "startsWith(github.ref, 'refs/tags/inngest_encryption@')"
permissions:
id-token: write
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Install"
run: "make build"
working-directory: "./pkg/inngest_encryption"
- name: "Upload package to PyPI"
uses: "pypa/gh-action-pypi-publish@release/v1"

type-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Type check"
run: "make type-check"
working-directory: "./pkg/inngest_encryption"

utest:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Unit test"
run: "make utest"
working-directory: "./pkg/inngest_encryption"
66 changes: 66 additions & 0 deletions .github/workflows/other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "other"

on:
push:
branches:
- "main"
tags:
- "*"
pull_request:
paths:
- "**/*.py"
- ".github/**"
- "Makefile"
- "constraints.txt"
- "pyproject.toml"
- "pytest.ini"
- "ruff.toml"

jobs:
format-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Format check"
run: "make format-check"

lint:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Lint"
run: "make lint"

type-check:
runs-on: "ubuntu-latest"
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: "actions/checkout@v2"
- name: "Set up Python ${{ matrix.python-version }}"
uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install"
run: "make install"
- name: "Type check"
run: "make type-check"
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
"editor.formatOnSave": true,
"mypy-type-checker.importStrategy": "fromEnvironment",
"mypy-type-checker.preferDaemon": true,
"python.analysis.extraPaths": [
"pkg/inngest",
"pkg/inngest_encryption",
"pkg/test_core"
],
"python.analysis.typeCheckingMode": "basic",
"python.languageServer": "Pylance",
"ruff.fixAll": true
Expand Down
29 changes: 13 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
.PHONY: build
build:
@if [ -d "dist" ]; then rm -rf dist; fi
@python -m build

check-venv:
@if [ -z "$${CI}" ] && [ -z "$${VIRTUAL_ENV}" ]; then \
echo "virtual environment is not activated"; \
Expand All @@ -16,24 +11,26 @@ format-check: check-venv
@ruff format .

install: check-venv
@pip install -e '.[extra]' -c constraints.txt
@pip install -e '.[extra]' -e ./pkg/inngest -e ./pkg/test_core -c constraints.txt

itest: check-venv
@pytest -n 4 -v tests
@cd pkg/inngest && make itest
@cd pkg/inngest_encryption && make itest

pre-commit: format-check lint type-check utest

release:
@grep "version = \"$${VERSION}\"" pyproject.toml && git tag $${VERSION} && git push origin $${VERSION} || echo "pyproject.toml version does not match"

lint: check-venv
@ruff check .
@cd examples && make lint
@cd pkg/inngest && make lint
@cd pkg/inngest_encryption && make lint
@cd pkg/test_core && make lint

type-check: check-venv
@mypy inngest tests
@mypy examples/fast_api
@mypy examples/flask
@mypy examples/tornado
@cd examples && make type-check
@cd pkg/inngest && make type-check
@cd pkg/inngest_encryption && make type-check
@cd pkg/test_core && make type-check

utest: check-venv
@pytest -v inngest
@cd pkg/inngest && make utest
@cd pkg/inngest_encryption && make utest
19 changes: 19 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export MYPYPATH=../pkg/inngest:../pkg/inngest_encryption:../pkg/test_core

.PHONY: check-venv
check-venv:
@if [ -z "$${CI}" ] && [ -z "$${VIRTUAL_ENV}" ]; then \
echo "virtual environment is not activated"; \
exit 1; \
fi

.PHONY: lint
lint: check-venv
@ruff check .

.PHONY: type-check
type-check: check-venv
@mypy --config-file=../mypy.ini ./digital_ocean
@mypy --config-file=../mypy.ini ./fast_api
@mypy --config-file=../mypy.ini ./flask
@mypy --config-file=../mypy.ini ./tornado
5 changes: 2 additions & 3 deletions examples/digital_ocean/app.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from src.inngest.client import inngest_client
from src.inngest.functions import hello

import inngest.digital_ocean
from inngest.experimental.digital_ocean_simulator import DigitalOceanSimulator
from src.inngest.client import inngest_client
from src.inngest.functions import hello

main = inngest.digital_ocean.serve(
inngest_client,
Expand Down
3 changes: 1 addition & 2 deletions examples/django/inngest_django/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import inngest.django
from django.contrib import admin
from django.urls import path

import inngest.django

from .functions import hello
from .inngest_client import inngest_client

Expand Down
3 changes: 1 addition & 2 deletions examples/fast_api/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import fastapi
import inngest.fast_api
from src.inngest.client import inngest_client
from src.inngest.functions import hello

import inngest.fast_api

app = fastapi.FastAPI()


Expand Down
3 changes: 1 addition & 2 deletions examples/flask/app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import inngest.flask
from src.flask import app
from src.inngest.client import inngest_client
from src.inngest.functions import hello

import inngest.flask

inngest.flask.serve(
app,
inngest_client,
Expand Down
Loading

0 comments on commit b37ca72

Please sign in to comment.