Skip to content

updated imports

updated imports #68

Workflow file for this run

name: Test and Deploy
on:
push:
branches: [main, dev, test]
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE
- name: Check out repository
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-access-key-id: ${{ secrets.SLS_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SLS_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
# Set up Python 3.9 environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
# Install Python dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Run tests
- name: Run tests
run: python -m pytest
deploy:
needs:
- run-tests
runs-on: ubuntu-latest
steps:
# Configure the deployment stage name from the active branch
- name: Set up deployment stage name
id: deployment-stage
run: |
echo "DEPLOY_STAGE=${{ fromJSON('{"main":"prod","dev":"dev","test":"test"}')[github.ref_name] }}" >> $GITHUB_ENV
- name: Verify Stage
run: echo $DEPLOY_STAGE
# Checks-out the repository under $GITHUB_WORKSPACE
- uses: actions/checkout@v2
# Configure Auth0 secrets
- name: Create public_key file
run: |
cat > /home/runner/work/photonranch-api/photonranch-api/public_key << EOF
-----BEGIN CERTIFICATE-----
${{ secrets.AUTH0_PUBLIC_KEY }}
-----END CERTIFICATE-----
EOF
- name: Create Auth0 secrets file
run: |
cat > /home/runner/work/photonranch-api/photonranch-api/secrets.json << EOF
{
"AUTH0_CLIENT_ID": "${{ secrets.AUTH0_CLIENT_ID }}"
}
EOF
# Set up Node
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 18.x
# Read public key
- name: Read Public Key
run: |
{
echo "PUBLIC_KEY<<EOF"
cat ./public_key
echo EOF
} >> $GITHUB_ENV
# Set up Python 3.9 environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
# Install serverless
- name: Install Serverless
run: npm install -g serverless
# Install Node dependencies
- name: Set up Environment
run: npm ci --include=dev
# Deploy to stage
- name: Serverless Deploy
run: sls deploy --stage $DEPLOY_STAGE
env:
SERVERLESS_ACCESS_KEY: ${{ secrets.SLS_SECRET_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.SLS_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SLS_AWS_SECRET_ACCESS_KEY }}