add infinity,businessforms; first commit of adventure2 dashboard #10
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: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- main # Trigger on pushes to the main branch | |
- microservice | |
workflow_dispatch: # Allow manual triggers | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
FOO: bar | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout Code | |
uses: actions/[email protected] | |
# Step 2: Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
# Step 3: Install dependencies | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pytest pytest-cov | |
# Step 4: Run tests with coverage | |
- name: Run Tests with Coverage | |
run: | | |
PYTHONPATH=$(pwd):$PYTHONPATH pytest --cov=app --cov-report=xml --cov-report=html tests/ | |
# Step 5: Upload coverage report as an artifact | |
- name: Upload Coverage Report | |
uses: actions/[email protected] | |
with: | |
name: coverage-report | |
path: htmlcov/ | |
build-and-push: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/[email protected] | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GCLOUD_SA_KEY }}' | |
# Step 2: Set up Google Cloud SDK | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
project_id: ${{ secrets.GCLOUD_PROJECT }} | |
# Step 3: Authenticate Docker with Google Cloud Artifact Registry | |
- name: Authenticate Docker with GCloud | |
run: | | |
gcloud config set account '${{ secrets.GCLOUD_SA_ACCOUNT }}' | |
gcloud auth configure-docker ${DOCKER_REGISTRY} | |
# Step 4: Build the Docker image | |
- name: Build Docker image | |
run: | | |
docker build -t ${IMAGE_NAME}:${IMAGE_TAG} . | |
echo ${IMAGE_NAME} | |
# Step 5: Push the Docker image to Google Cloud Artifact Registry | |
- name: Push Docker image | |
run: | | |
gcloud auth configure-docker ${DOCKER_REGISTRY} | |
docker push ${IMAGE_NAME}:${IMAGE_TAG} | |
env: | |
DOCKER_REGISTRY: us-east4-docker.pkg.dev | |
GCLOUD_PROJECT: ${{ secrets.GCLOUD_PROJECT }} | |
IMAGE_NAME: us-east4-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/dev-advocacy/adventure | |
IMAGE_TAG: latest | |
deploy: | |
needs: | |
- test | |
- build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GCLOUD_SA_KEY }}' | |
# Step 2: Set up Google Cloud SDK | |
- name: Set up Google Cloud SDK | |
uses: google-github-actions/[email protected] | |
with: | |
project_id: ${{ secrets.GCLOUD_PROJECT }} | |
# Disable deploy step for now until we get it working full scope locally, then we can do the play bits. | |
# - name: Deploy to Cloud Run | |
# env: | |
# REGION: us-east4 | |
# DOCKER_REGISTRY: us-east4-docker.pkg.dev | |
# IMAGE_NAME: us-east4-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/dev-advocacy/adventure | |
# IMAGE_TAG: latest | |
# GCP_PROJECT_ID: ${{ secrets.GCLOUD_PROJECT }} | |
# run: | | |
# gcloud run deploy adventure \ | |
# --project ${GCP_PROJECT_ID} \ | |
# --image ${IMAGE_NAME}:${IMAGE_TAG} \ | |
# --region ${REGION} \ | |
# --port 3000 \ | |
# --timeout 6m \ | |
# --vpc-connector adventure-vpc-connector \ | |
# --update-env-vars FOO=bar,REDIS_IP= | |