-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 1.68 KB
/
cipipeline.yaml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: ci pipeline
permissions:
id-token: write
contents: read
actions: read
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
branches:
- main
paths:
- 'lamb2numb/**'
- 'tests/**'
- 'pyproject.toml'
- 'poetry.lock'
- '.github/workflows/**'
jobs:
code:
name: Code
runs-on: ubuntu-latest
concurrency:
group: lambda-update
cancel-in-progress: false
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- name: Install dependencies
run: poetry install
- name: Verify code conventions
run:
poetry run ruff check .
- name: Run tests
run: poetry run pytest --cov=lamb2numb --cov-report=term-missing
- name: AWS login
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: gha-lambda-deploy-${{ github.event.repository.name }}
aws-region: ${{ vars.AWS_REGION }}
- name: Zip everything
run: zip -r lambda.zip *
- name: Deploy zip to lambda
env:
FUNCTION_NAME: ${{ secrets.FUNCTION_NAME }}
run: aws lambda update-function-code
--function-name $FUNCTION_NAME
--zip-file fileb://lambda.zip
- name: Wait for lambda to be updated
env:
FUNCTION_NAME: ${{ secrets.FUNCTION_NAME }}
run: aws lambda wait function-updated
--function-name $FUNCTION_NAME
--output text