Skip to content

Commit

Permalink
lets test 'er out
Browse files Browse the repository at this point in the history
  • Loading branch information
voynow committed Aug 6, 2024
1 parent d430680 commit 904f83a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 5 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy to Lambda

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.8' # Specify your Python version

- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
- name: Install dependencies and package code
run: ./build.sh

- name: Setup AWS CLI
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1 # Update as per your region

- name: Deploy to Lambda
run: |
aws lambda update-function-code \
--function-name my-lambda-function \
--zip-file fileb://function.zip
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

rm -rf package
rm function.zip

poetry export -f requirements.txt --output requirements.txt --without-hashes
pip install --target ./package -r requirements.txt

cd package
zip -r ../function.zip .
cd ..
zip -g function.zip src/lambda_function.py
24 changes: 19 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "strava"
version = "0.1.0"
description = ""
authors = ["voynow <voynow99@gmail.com>"]
readme = "README.md"

[tool.turbo_docs]
ignore = [
"pyproject.toml",
"__pycache__",
".venv",
"build",
"dist",
"*.egg-info",
".git",
".env",
"poetry.lock",
".gitignore",
"*.ipynb"
]

[tool.poetry.dependencies]
python = "^3.10"
stravalib = "^v1.7"
Expand All @@ -14,10 +33,5 @@ polars = "^0.20.31"
urllib3 = "2.2.1"
openai = "^1.35.3"


[tool.poetry.group.dev.dependencies]
ipykernel = "^6.29.4"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
2 changes: 2 additions & 0 deletions src/lambda_function.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def lambda_handler(event, context):
return {"statusCode": 200, "body": "Hello, world!"}

0 comments on commit 904f83a

Please sign in to comment.