generated from ran-isenberg/aws-lambda-handler-cookbook
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ran Isenberg <[email protected]>
- Loading branch information
1 parent
e4c91b4
commit bb4744a
Showing
74 changed files
with
1,524 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[flake8] | ||
exclude = .eggs, setup.py, example, .cdk,out, .git, dist, *.md, *.yaml, *.txt, *.ini | ||
exclude = .eggs, setup.py, example, .cdk,out, .git, dist, *.md, *.yaml, *.txt, *.ini, build, cdk.json, cdk.context.json, cdk.out, node_modules | ||
ignore = E203, E266, W503, BLK100, W291, I004 | ||
max-line-length = 150 | ||
max-complexity = 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# These are supported funding model platforms | ||
|
||
github: ran-isenberg | ||
patreon: # Replace with a single Patreon username | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
{{cookiecutter.repo_name}}/.github/workflows/comment_issues.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
name: Comment when opened | ||
|
||
permissions: | ||
issues: write | ||
checks: read | ||
contents: read | ||
|
||
on: | ||
issues: | ||
types: | ||
|
155 changes: 155 additions & 0 deletions
155
{{cookiecutter.repo_name}}/.github/workflows/main-serverless-service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
name: Main Branch - Serverless Service CI/CD | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
NODE_VERSION: "18" | ||
PYTHON_VERSION: "3.11" | ||
AWS_REGION: "us-east-1" | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
staging: | ||
runs-on: ubuntu-latest | ||
environment: staging | ||
permissions: | ||
id-token: write # required for requesting the JWT (GitHub OIDC) | ||
steps: | ||
- run: | | ||
echo "🎉 The job was automatically triggered by a ${{ env.EVENT_NAME }} event." >> $GITHUB_STEP_SUMMARY | ||
echo "🐧 This job is now running on a ${{ env.OS_NAME }} ${{env.OS_ARCH}} server hosted by GitHub!" >> $GITHUB_STEP_SUMMARY | ||
echo "🔎 The name of your branch is ${{ env.BRANCH_NAME }} and your repository is ${{ env.REPO_NAME }}." >> $GITHUB_STEP_SUMMARY | ||
env: | ||
EVENT_NAME: ${{ github.event_name}} | ||
OS_NAME: ${{ runner.os }} | ||
OS_ARCH: ${{runner.arch }} | ||
BRANCH_NAME: ${{ github.ref }} | ||
REPO_NAME: ${{ github.repository }} | ||
- name: Check out repository code | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: Set up Python | ||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work | ||
- name: Set up Node | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: make dev | ||
# NOTE: unit tests are connecting to AWS to instantiate boto3 clients/resources | ||
# once that's discussed we can move unit and infra tests as part of the fast quality standards | ||
# see https://github.com/ran-isenberg/serverless-python-demo/pull/38#discussion_r1299372169 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 | ||
with: | ||
role-to-assume: ${{ secrets['AWS_ROLE'] }} | ||
role-session-name: ${{ env.SESSION_NAME }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
env: | ||
SESSION_NAME: "github-${{github.sha}}-staging" | ||
- name: Deploy to AWS | ||
run: make deploy | ||
env: | ||
ENVIRONMENT: staging # Custom environment variable | ||
# NOTE: these run unit and integration tests | ||
# we can look into coverage collection only later to make it faster and less brittle (--collect-only) | ||
- name: Code coverage tests | ||
run: make coverage-tests | ||
env: | ||
ENVIRONMENT: staging # Custom environment variable | ||
- name: Codecov | ||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | ||
with: | ||
files: ./coverage.xml | ||
fail_ci_if_error: false # optional (default = false) | ||
verbose: false # optional (default = false) | ||
- name: Run E2E tests | ||
run: make e2e | ||
env: | ||
ENVIRONMENT: staging # Custom environment variable | ||
|
||
production: | ||
runs-on: ubuntu-latest | ||
needs: [staging] | ||
environment: production | ||
permissions: | ||
id-token: write # required for requesting the JWT (GitHub OIDC) | ||
steps: | ||
- run: | | ||
echo "🎉 The job was automatically triggered by a ${{ env.EVENT_NAME }} event." >> $GITHUB_STEP_SUMMARY | ||
echo "🐧 This job is now running on a ${{ env.OS_NAME }} ${{env.OS_ARCH}} server hosted by GitHub!" >> $GITHUB_STEP_SUMMARY | ||
echo "🔎 The name of your branch is ${{ env.BRANCH_NAME }} and your repository is ${{ env.REPO_NAME }}." >> $GITHUB_STEP_SUMMARY | ||
env: | ||
EVENT_NAME: ${{ github.event_name}} | ||
OS_NAME: ${{ runner.os }} | ||
OS_ARCH: ${{runner.arch }} | ||
BRANCH_NAME: ${{ github.ref }} | ||
REPO_NAME: ${{ github.repository }} | ||
- name: Check out repository code | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: Set up Python | ||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work | ||
- name: Set up Node | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: make dev | ||
# NOTE: unit tests are connecting to AWS to instantiate boto3 clients/resources | ||
# once that's discussed we can move unit and infra tests as part of the fast quality standards | ||
# see https://github.com/ran-isenberg/serverless-python-demo/pull/38#discussion_r1299372169 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 | ||
with: | ||
role-to-assume: ${{ secrets['AWS_ROLE'] }} | ||
role-session-name: ${{ env.SESSION_NAME }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
env: | ||
SESSION_NAME: "github-${{github.sha}}-production" | ||
- name: Deploy to AWS | ||
run: make deploy | ||
env: | ||
ENVIRONMENT: production # Custom environment variable | ||
|
||
publish_github_pages: | ||
runs-on: ubuntu-latest | ||
needs: [production] | ||
permissions: | ||
contents: write # for docs push | ||
if: contains('refs/heads/main', github.ref) | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: Set up Python | ||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
- name: Set up Node | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: make dev | ||
- name: Generate docs | ||
run: | | ||
poetry run mkdocs gh-deploy --force |
104 changes: 104 additions & 0 deletions
104
{{cookiecutter.repo_name}}/.github/workflows/pr-serverless-service.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
name: PR - Serverless Service CI/CD | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
NODE_VERSION: "18" | ||
PYTHON_VERSION: "3.11" | ||
AWS_REGION: "us-east-1" | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
quality_standards: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
echo "🎉 The job was automatically triggered by a ${{ env.EVENT_NAME }} event." >> $GITHUB_STEP_SUMMARY | ||
echo "🐧 This job is now running on a ${{ env.OS_NAME }} ${{env.OS_ARCH}} server hosted by GitHub!" >> $GITHUB_STEP_SUMMARY | ||
echo "🔎 The name of your branch is ${{ env.BRANCH_NAME }} and your repository is ${{ env.REPO_NAME }}." >> $GITHUB_STEP_SUMMARY | ||
env: | ||
EVENT_NAME: ${{ github.event_name}} | ||
OS_NAME: ${{ runner.os }} | ||
OS_ARCH: ${{runner.arch }} | ||
BRANCH_NAME: ${{ github.ref }} | ||
REPO_NAME: ${{ github.repository }} | ||
- name: Check out repository code | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: Set up Python | ||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work | ||
- name: Install dependencies | ||
run: make dev | ||
- name: pre commit | ||
run: make pre-commit | ||
- name: Formatting and Linting | ||
run: make lint | ||
- name: Complexity scan | ||
run: make complex | ||
tests: | ||
needs: quality_standards | ||
runs-on: ubuntu-latest | ||
environment: dev | ||
permissions: | ||
id-token: write # required for requesting the JWT (GitHub OIDC) | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | ||
- name: Install poetry | ||
run: pipx install poetry | ||
- name: Set up Python | ||
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
cache: "poetry" # NOTE: poetry must be installed before this step, or else cache doesn't work | ||
- name: Set up Node | ||
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: "npm" | ||
- name: Install dependencies | ||
run: make dev | ||
# NOTE: unit tests are connecting to AWS to instantiate boto3 clients/resources | ||
# once that's discussed we can move unit and infra tests as part of the fast quality standards | ||
# see https://github.com/ran-isenberg/serverless-python-demo/pull/38#discussion_r1299372169 | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE }} | ||
role-session-name: ${{ env.SESSION_NAME }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
env: | ||
SESSION_NAME: "github-${{github.sha}}-dev" | ||
- name: Unit tests | ||
run: make unit | ||
- name: Infrastructure tests | ||
run: make infra-tests | ||
- name: Deploy to AWS | ||
run: make deploy | ||
# NOTE: these run unit and integration tests | ||
# we can look into coverage collection only later to make it faster and less brittle (--collect-only) | ||
- name: Code coverage tests | ||
run: make coverage-tests | ||
- name: Codecov | ||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | ||
with: | ||
files: ./coverage.xml | ||
fail_ci_if_error: false # optional (default = false) | ||
verbose: false # optional (default = false) | ||
- name: Run E2E tests | ||
run: make e2e | ||
- name: Destroy stack | ||
if: always() | ||
run: make destroy |
Oops, something went wrong.