-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (47 loc) · 1.63 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: deploy to lambda
on:
push:
branches:
- main
jobs:
deploy_source:
environment: production
name: build and deploy lambda
strategy:
matrix:
python-version: [3.9]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff pytest
if [ -f requirements.txt ]; then pip install --target ./python-local/lib/python3.9/site-packages -r requirements.txt --upgrade; fi
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
# ruff --format=github --select=E9,F63,F7,F82 --target-version=py39 ./src
# default set of ruff rules with GitHub Annotations
# ruff check --format=github --target-version=py39 ./src
- name: Test with pytest
run: |
pytest tests
- name: Delete python-local
run: rm -rf ./python-local/lib/python3.9/site-packages
- name: zip
uses: montudor/action-zip@v0.1.0
with:
args: zip -qq -r ./bundle.zip ./
- name: default deploy
uses: appleboy/lambda-action@master
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-west-2
function_name: ${{ secrets.AWS_FUNCTION_NAME }}
zip_file: bundle.zip