Skip to content
Open
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
21 changes: 19 additions & 2 deletions .github/workflows/lambda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- complete

jobs:
deploy:
Expand All @@ -20,12 +21,28 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

# - run: npm ci
# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v1
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- run: npm ci

- name: serverless deploy
uses: serverless/github-action@v3.1
with:
args: deploy
args: -c "serverless plugin install --name serverless-wsgi && serverless plugin install --name serverless-python-requirements && serverless deploy --verbose"
entrypoint: /bin/sh
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35 changes: 35 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Pruebas Unitarias
on: push

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Check out repository code
uses: actions/checkout@v2

# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.x"

- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v1
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev

- name: Run test suite
run: |
pipenv run test -v
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ dist
venv
.venv/

.idea/
.idea/
16 changes: 16 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
pytest = "~=7.1.2"
Flask = "~=2.2.2"

[dev-packages]

[requires]
python_version = "3.8"

[scripts]
test = "pytest"
186 changes: 186 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from flask import Flask


app = Flask('app')

productos = {
1: "Hello Kitty",
2: "Peluche",
3: "Carrito"
}


@app.route("/productos", methods=["GET"])
def get_productos():
return productos, 200


@app.route("/productos/<id>", methods=["DELETE"])
def delete_productos(id):
del productos[id]
return productos, 200
Loading