Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab 5 #57

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
75 changes: 75 additions & 0 deletions .github/workflows/deploy-pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Deploy Lambda Function
on: [push]

jobs:

lint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install libraries
run: pip install flake8
- name: Lint with flake8
run: |
cd function
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

build:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install libraries
run: |
cd function
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt -t .; fi
- name: Zip bundle
run: |
cd function
zip -r ../${{ github.sha }}.zip .
- name: Archive artifact
uses: actions/upload-artifact@v2
with:
name: zipped-bundle
path: ${{ github.sha }}.zip

publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.run_number }}
release_name: Release ${{ github.run_number }}
body: New release for ${{ github.sha }}. Release notes can be found in the docs.
draft: false
prerelease: false
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: zipped-bundle
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ github.sha }}.zip
asset_name: source_code_with_libraries.zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion function/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def lambda_handler(event, context):
Returns:
string: greeting response
"""
print('Starting functions\n---------------------------------------------'
print('Starting functions\n---------------------------------------------')

if event["input"] == "Hello":

Expand Down
2 changes: 1 addition & 1 deletion function/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Github==1.55
PyGithub==1.55
boto3==1.17.96
20 changes: 20 additions & 0 deletions userguide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# User Guide

## Install

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

## Troubleshooting

- Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
- Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
- Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

## Contact us

| Lorem | ipsum | dolor |
| ------------- |-------------| -----|
| Ut enim ad minim veniam | quis nostrud exercitation ullamco | laboris nisi ut aliquip ex ea commodo consequat |
| Duis aute irure | dolor in reprehenderit in | voluptate velit esse cillum dolore eu fugiat nulla pariatur |
| Excepteur sint occaecat | cupidatat non proident | sunt in culpa qui officia deserunt mollit anim id est laborum |