Test workflows #21
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: Python CI | |
on: | |
push: | |
branches: | |
- development | |
- base | |
pull_request: | |
branches: | |
- development | |
jobs: | |
build: | |
if: github.ref != 'refs/heads/base' || github.ref != 'refs/heads/development' | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
- name: Install dependencies | |
run: pip install tox | |
- name: Run tests | |
run: tox | |
deploy: | |
needs: build | |
#if: github.ref != 'refs/heads/base' || github.ref != 'refs/heads/development' | |
runs-on: ubuntu-latest | |
environment: development | |
env: | |
LAMBDA_NAME: digitized_av_notifications | |
LAMBDA_HANDLER_CODE: src/handle_digitized_av_notifications.py | |
BASENAME: handle_digitized_av_notifications.py | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Clone deploy scripts if not present | |
run: | | |
if [ ! -d deploy_scripts ]; then | |
git clone https://github.com/RockefellerArchiveCenter/deploy_scripts.git; | |
fi | |
- name: Export secrets to environment variables | |
uses: oNaiPs/[email protected] | |
with: | |
secrets: ${{ toJSON(secrets) }} | |
- name: Substitute environment variables | |
uses: tvarohohlavy/[email protected] | |
with: | |
files: | | |
deploy_scripts/deploy_package_lambda.sh | |
- name: Make zip file | |
run: | | |
cp ${{ env.LAMBDA_HANDLER_CODE }} ${{ env.BASENAME }} | |
zip ${{ env.LAMBDA_NAME }}.zip ${{ env.BASENAME }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
aws-region: us-east-1 | |
- name: Upload files to S3 | |
run: aws s3 cp $LAMBDA_NAME.zip s3://$LAMBDA_BUCKET_NAME/$LAMBDA_NAME.zip | |
#Replace these with actual AWS commands. Separate them out | |
#- name: Deploy to Development | |
#if: github.ref == 'refs/heads/development' | |
#run: | | |
#bash deploy_scripts/upload_file_to_s3.sh ${LAMBDA_NAME}.template ${CLOUDFORMATION_BUCKET_NAME} && | |
#bash deploy_scripts/upload_file_to_s3.sh ${LAMBDA_NAME}.zip ${LAMBDA_BUCKET_NAME} && | |
#bash deploy_scripts/deploy_package_lambda.sh ${LAMBDA_NAME} | |
#- name: Deploy to Base | |
#if: github.ref == 'refs/heads/base' | |
#run: | | |
#bash deploy_scripts/upload_file_to_s3.sh ${LAMBDA_NAME}.template rac-prod-cloudformation-apps && | |
#bash deploy_scripts/upload_file_to_s3.sh ${LAMBDA_NAME}.zip rac-prod-lambda && | |
#bash deploy_scripts/deploy_package_lambda.sh ${LAMBDA_NAME} |