Skip to content

add max to get_data function #100

add max to get_data function

add max to get_data function #100

Workflow file for this run

name: Pipeline
on:
push:
branches:
- test
- main
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
env:
AWS_REGION: us-east-1
ENVIRONMENT: ${{ github.ref_name == 'main' && 'prod' || github.ref_name == 'test' && 'test' }}
jobs:
test-lambda:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: lambda_code
steps:
- uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
# Install dependencies
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --group test
# Run unit tests
# - name: Run tests
# run: uv run pytest -s .
build-lambda:
runs-on: ubuntu-22.04
needs: test-lambda
defaults:
run:
working-directory: lambda_code
steps:
- uses: actions/checkout@v3
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
# Install dependencies
- name: Set up Python
run: uv python install
- name: Build Lambda
run: |
mkdir -p build
cp -r src/* build/
uv pip compile pyproject.toml -o build/requirements.txt
uv pip install -r build/requirements.txt --target build --python-platform x86_64-manylinux_2_40 --only-binary=:all:
- name: Upload build as artifact
uses: actions/upload-artifact@v4
with:
name: lambda-code-build
path: lambda_code/build
if-no-files-found: error
deploy-stack:
runs-on: ubuntu-22.04
needs: build-lambda
defaults:
run:
working-directory: terraform
steps:
- uses: actions/checkout@v3
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: lambda-code-build
path: lambda_code/build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
aws-region: ${{ env.AWS_REGION }}
role-to-assume: arn:aws:iam::639269844451:role/github-actions
role-session-name: testing-deployment
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform Init
run: terraform init
- name: Select or Create Terraform Workspace
run: |
terraform workspace list || echo "Workspace list unavailable"
terraform workspace select --or-create ${{ env.ENVIRONMENT }}
- name: Terraform Plan
run: terraform plan
- name: Terraform Apply
run: terraform apply -auto-approve