-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (51 loc) · 1.49 KB
/
sam-pipeline.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
48
49
50
51
52
53
54
on:
push:
branches:
- main
paths:
- 'src/**'
- 'tests/**'
- '.github/workflows/**'
- 'templage.yml'
- 'samconfig.toml'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: 'pip'
- name: Execute unit tests and coverage report
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run unit tests
run: python -m coverage run -m unittest -v tests/*.py
- name: Run coverage report
run: python -m coverage report -m
build-and-deploy:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'pip'
- uses: aws-actions/setup-sam@v2
with:
use-installer: true
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
# sam build
- name: Run SAM Build
run: sam build --use-container
# sam deploy
- name: Run SAM Deploy
run: sam deploy --s3-bucket ${{ secrets.AWS_BUCKET_NAME }} --no-confirm-changeset --no-fail-on-empty-changeset