Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/ci-lambda-deps-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI Lambda Deps Builder

on:
push:
branches:
- '*'
paths:
- 'lambda_deps_builder/**'
- '.github/workflows/*lambda-deps*'
pull_request:
branches:
- main
- master
paths:
- 'lambda_deps_builder/**'
- '.github/workflows/*lambda-deps*'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install dependencies and package
run: |
python -m pip install --upgrade pip
pip install ./lambda_deps_builder
pip install pytest boto3

- name: Run unit & synth tests
run: |
pytest lambda_deps_builder/tests -v

build-check:
name: Verify package build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install build tooling
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build wheel and sdist
run: |
python -m build --sdist --wheel lambda_deps_builder --outdir dist

- name: Check distributions with twine
run: |
twine check dist/*
94 changes: 94 additions & 0 deletions .github/workflows/release-lambda-deps-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Release Lambda Deps Builder to PyPI

on:
push:
branches:
- main
- master
paths:
- 'lambda_deps_builder/**'
- '.github/workflows/release-lambda-deps-builder.yml'
release:
types: [published]
workflow_dispatch:
inputs:
dry-run:
description: "Build everything but skip the publish step"
type: boolean
default: false

permissions:
contents: read
id-token: write

jobs:
build:
name: Build distribution packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"

- name: Install build tooling
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build sdist and wheel
run: |
python -m build --sdist --wheel lambda_deps_builder --outdir dist

- name: Check package metadata
run: |
twine check dist/*

- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
retention-days: 7

publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment: pypi
if: ${{ github.event_name != 'workflow_dispatch' || !inputs.dry-run }}
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Check for PyPI API token
id: token-check
env:
TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
if [ -n "$TOKEN" ]; then
echo "has_token=true" >> "$GITHUB_OUTPUT"
else
echo "has_token=false" >> "$GITHUB_OUTPUT"
fi

- name: Publish to PyPI (Trusted Publishing OIDC)
if: steps.token-check.outputs.has_token == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
skip-existing: true

- name: Publish to PyPI (API Token fallback)
if: steps.token-check.outputs.has_token == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
dist/
build/
*.egg-info/

# Virtual environments
.venv/
env/
venv/
ENV/

# Testing & CDK
.pytest_cache/
cdk.out/
.cdk.staging/
2 changes: 2 additions & 0 deletions lambda_deps_builder/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ __pycache__/
.pytest_cache/
cdk.out/
.cdk.staging/
dist/
build/
3 changes: 2 additions & 1 deletion lambda_deps_builder/lambda_deps_builder/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from lambda_deps_builder.construct import LambdaDepsBuilder

__all__ = ["LambdaDepsBuilder"]
__version__ = "0.1.0"
__all__ = ["LambdaDepsBuilder", "__version__"]
1 change: 1 addition & 0 deletions lambda_deps_builder/lambda_deps_builder/py.typed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Marker file for PEP 561.
23 changes: 19 additions & 4 deletions lambda_deps_builder/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@
name = "lambda-deps-builder"
version = "0.1.0"
description = "CDK construct that builds Python Lambda dependencies inside Lambda — no local Docker."
authors = ["POC <noreply@example.com>"]
authors = ["Alexy Grabov <alexy.grabov@gmail.com>"]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/CoreOxide/poc"
homepage = "https://github.com/CoreOxide/poc/tree/main/lambda_deps_builder"
keywords = ["aws", "cdk", "lambda", "dependencies", "dockerless", "layer"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Topic :: Software Development :: Build Tools",
"Typing :: Typed",
]
packages = [{ include = "lambda_deps_builder" }]

[tool.poetry.dependencies]
python = "^3.11"
aws-cdk-lib = "^2.150.0"
constructs = "^10.0.0"
python = ">=3.11,<4.0"
aws-cdk-lib = ">=2.150.0"
constructs = ">=10.0.0"

[tool.poetry.group.dev.dependencies]
pytest = "^8.0.0"
Expand Down
Loading