Test workflows #3
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: | |
if: github.ref != 'refs/heads/base' || github.ref != 'refs/heads/development' | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name }} | |
env: | |
LAMBDA_NAME: digitized_av_notifications | |
LAMBDA_HANDLER_CODE: src/handle_digitized_av_notifications.py | |
BASENAME: $(basename ${LAMBDA_HANDLER_CODE}) | |
steps: | |
- name: Clone deploy scripts if not present | |
run: | | |
if [ ! -d deploy_scripts ]; then | |
git clone https://github.com/RockefellerArchiveCenter/deploy_scripts.git; | |
fi | |
- name: Make zip file | |
run: | | |
cp ${LAMBDA_HANDLER_CODE} ${BASENAME} | |
zip ${LAMBDA_NAME}.zip ${BASENAME} | |
#- name: Substitute environment variables | |
#uses: tvarohohlavy/[email protected] | |
#with: | |
#files: | | |
#deploy_scripts/make_zip_lambda.sh | |
#- 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: Create Lambda ZIP package | |
#run: | | |
#sudo deploy_scripts/make_zip_lambda.sh $LAMBDA_NAME src/handle_digitized_av_notifications.py | |
#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 rac-dev-cloudformation-apps && | |
#bash deploy_scripts/upload_file_to_s3.sh ${LAMBDA_NAME}.zip rac-dev-lambda && | |
#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} |