diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 654694b9..d5b6374c 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -117,100 +117,13 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: ${{ inputs.python-version }} - - - name: Get pip cache dir - id: pip-cache - shell: bash - run: | - python -m pip install pip --upgrade - echo "PIP_CACHE_DIR=$(python -m pip cache dir)" >> $GITHUB_ENV - - - name: Cache pip - uses: actions/cache@v4 - with: - path: ${{ env.PIP_CACHE_DIR }} - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - - name: Configure GCP Credentials - uses: google-github-actions/auth@v2 - with: - workload_identity_provider: "projects/734798842681/locations/global/workloadIdentityPools/my-pool/providers/gh-provider" - service_account: "git-cerulean-cloud@cerulean-338116.iam.gserviceaccount.com" - - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 + - id: deploy-infrastructure-test + name: Deploy Infrastructure + uses: ./.github/actions/deploy_infrastructure with: - role-to-assume: arn:aws:iam::162277344632:role/CeruleanCloudDeploy - aws-region: eu-central-1 - - - name: Configure docker - shell: bash - run: | - gcloud auth configure-docker -q - - - name: Install Pulumi requirements - shell: bash - run: | - pip install -r requirements-pulumi.txt - - - name: Build Container Images - uses: pulumi/actions@v5 - id: pulumi-images - env: - PULUMI_CONFIG_PASSPHRASE: "test" - with: - pulumi-version: "3.121.0" - work-dir: images/ - command: up - stack-name: "test" - - - name: Prune Docker environment - shell: bash - run: | - docker container prune -f - docker buildx prune -f - docker images - - # Copy shared database_client.py files - - name: Copy Shared File - shell: bash - run: | - mkdir -p cerulean_cloud/cloud_function_ais_analysis/cerulean_cloud/ - cp cerulean_cloud/database_client.py cerulean_cloud/cloud_function_ais_analysis/cerulean_cloud/database_client.py - cp cerulean_cloud/database_schema.py cerulean_cloud/cloud_function_ais_analysis/cerulean_cloud/database_schema.py - cp cerulean_cloud/__init__.py cerulean_cloud/cloud_function_ais_analysis/cerulean_cloud/__init__.py - - - name: Deploy Infrastructure - uses: pulumi/actions@v5 - id: pulumi - env: - PULUMI_CONFIG_PASSPHRASE: "test" - MODEL: ${{ steps.pulumi-images.outputs.model }} - with: - pulumi-version: "3.121.0" - command: up - stack-name: "test" - refresh: true - diff: true - comment-on-summary: true - - - name: Start Google Cloud SQL Proxy - uses: wagnerpereira/gce-cloudsql-proxy-action@v2 - with: - instance: ${{ steps.pulumi.outputs.database_instance_name }} - - - name: Run database migrations - shell: bash - env: - DB_URL: ${{ steps.pulumi.outputs.database_url_alembic }} - run: | - pip install -r requirements.txt && alembic upgrade head + environment: test + pulumi-version: 3.121.0 + pulumi-stack-passphrase: test deploy-staging: name: Deploy [STAGING]