Intial project

This commit is contained in:
Layla 2020-10-04 18:14:24 -04:00
parent 3657995de4
commit 10571c76ff
8 changed files with 240 additions and 0 deletions

19
.github/workflows/test_action.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Test Action
on: [push, pull_request, workflow_dispatch]
jobs:
TestAction:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run Action
uses: ./
with:
directory: test_project
environment: test
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM amazon/aws-cli:latest
LABEL "com.github.actions.name"="Zappa Deploy"
LABEL "com.github.actions.description"="Deploys a Zappa application to AWS"
LABEL "com.github.actions.icon"="package"
LABEL "com.github.actions.color"="blue"
LABEL repository="https://github.com/josephbmanley/zappa-deploy-action"
LABEL maintainer="Joseph Manley <joseph@cloudsumu.com>"
USER root
ADD entrypoint.sh /entrypoint.sh
RUN chmod +x entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

19
action.yml Normal file
View File

@ -0,0 +1,19 @@
name: "Zappa Deploy"
description: "Deploys a Zappa application to AWS"
author: josephbmanley
inputs:
directory:
description: ""
default: "."
environment:
description: 'Name of the preset in `zappa_settings` to use'
required: true
runs:
using: docker
image: Dockerfile
args:
- ${{ inputs.directory }}
- ${{ inputs.environment }}
branding:
icon: package
color: blue

30
entrypoint.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/sh
set -e
# Move to project directory
cd $1
# Install virtual environment
pip install virtualenv
virtualenv .venv
source ./.venv/bin/activate
# Install Zappa
pip install zappa
# Install requirements
pip install -r requirements.txt
{
# Check status (whether to update or deploy)
zappa status $2
# Update environment
echo "Starting update..."
zappa update $2
} || {
# Deploy environment
echo "Starting deployment..."
zappa deploy $2
}

138
test_project/.gitignore vendored Normal file
View File

@ -0,0 +1,138 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/

View File

@ -0,0 +1,2 @@
zappa
flask

View File

@ -0,0 +1,11 @@
from flask import Flask
app = Flask(__name__)
app.secret_key = "test"
@app.route("/")
def index():
return "Hello World!"
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0')

View File

@ -0,0 +1,7 @@
test:
app_function: test.app
aws_region: us-east-1
profile_name: default
project_name: zappa-deploy-test
runtime: python3.7
s3_bucket: zappa-deploy-action-test-deploy