Update layerpipeline.yaml #38
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
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 |