Updates 2024-07-10 - Added in unit tests and basic search functionali… #1
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: Herding Cats Lambda Deploy | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'herding_cats_pipelines/lambda_jobs/**' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install Ruff | |
run: pip install ruff | |
- name: Run Ruff | |
run: ruff check ./herding_cats_pipelines/lambda_jobs | |
zip-and-upload: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies and zip Lambda function | |
run: | | |
cd ./herding_cats_pipelines/lambda_jobs | |
pip install -r requirements.txt -t ./package | |
cp *.py ./package/ | |
cd ./package && zip -r ../lambda_herding_cats_jobs.zip . | |
- name: Configure AWS credentials | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: "eu-west-2" | |
- name: Upload to S3 | |
run: | | |
cd ./herding_cats_pipelines/lambda_jobs | |
aws s3 cp lambda_herding_cats_jobs.zip s3://${{ secrets.S3_BUCKET_NAME }}/lambda_herding_cats_jobs.zip | |
- name: Update Lambda Function | |
run: | | |
aws lambda update-function-code \ | |
--function-name ${{ secrets.LAMBDA_FUNCTION_NAME }} \ | |
--s3-bucket ${{ secrets.LAMBDA_BUCKET }} \ | |
--s3-key lambda_herding_cats_jobs.zip |