Form addded and cost removed #63
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
# Pushes to Cloud but only if the tests pass! | |
name: Deploy to Cloud | |
on: [push, pull_request] | |
jobs: | |
run-tests: | |
name: Run Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Create and activate virtual environment | |
run: | | |
python -m venv venv | |
source venv/bin/activate | |
- name: Install dependencies | |
run: | | |
source venv/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Set up environment | |
run: | | |
source venv/bin/activate | |
export PYTHONPATH="$PYTHONPATH:$(pwd)" | |
source ./add_root_to_path.sh | |
- name: Run tests without coverage | |
run: | | |
source venv/bin/activate | |
export PYTHONPATH="$PYTHONPATH:$(pwd)" | |
pytest | |
build-and-push: | |
name: Build and Push Docker Images | |
runs-on: ubuntu-latest | |
needs: run-tests # This ensures the 'run-tests' job must pass before this job runs | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Verify Environment Variables | |
run: | | |
echo "AWS_REGION: ${{ secrets.AWS_REGION }}" | |
echo "ECR_URL: ${{ secrets.ECR_URL }}" | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
ECR_URL: ${{ secrets.ECR_URL }} | |
- name: Log in to AWS ECR | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
ECR_URL: ${{ secrets.ECR_URL }} | |
run: | | |
aws ecr get-login-password --region $AWS_REGION | docker login --username AWS --password-stdin $ECR_URL | |
- name: Make build_and_push.sh executable and run it | |
run: | | |
cd infrastructure | |
chmod +x build_and_push.sh | |
./build_and_push.sh | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
ECR_URL: ${{ secrets.ECR_URL }} | |
- name: Logout from AWS ECR | |
run: docker logout ${{ secrets.ECR_URL }} |