Update GHA workflow for test and deployment #2
Workflow file for this run
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: Preview Deployment | |
on: | |
push: | |
branches: | |
- "*" | |
- "!main" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
environment: Preview | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.12 | |
cache: 'pip' | |
- run: pip install -r requirements.txt | |
- name: Run tests | |
run: pytest | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
deploy: | |
runs-on: ubuntu-latest | |
environment: Preview | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.12 | |
cache: 'pip' | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- run: pip install -r requirements.txt | |
- name: Create Package for AWS Lambda Layer | |
run: | | |
zip -r package.zip python/lib/python3.12/site-packages | |
- uses: pulumi/actions@v5 | |
with: | |
command: up | |
stack-name: staging | |
env: | |
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} | |
# - name: Deploy to AWS Lambda - Production | |
# if: env.ENVIRONMENT == 'Production' | |
# run: | | |
# aws lambda update-function-code --function-name prod-lta-datasets-updater --zip-file fileb://deployment_package.zip | |
# - name: Deploy | |
# run: | | |
# aws lambda update-function-code --function-name dev-lta-datasets-updater --zip-file fileb://deployment_package.zip |