Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanMendicutti committed Aug 24, 2023
1 parent 5fc499d commit cc169e3
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-and-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
test-and-build:
name: Integration
uses: ./.github/workflows/test-and-build.yml
secrets: inherit

deploy-to-staging:
name: Staging
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/review-env-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Review Environment Cleanup

on:
pull_request:
branches:
- main
types:
- closed

# Generate a GitHub token that can be exchanged with Google Cloud - see
# https://github.com/google-github-actions/auth/tree/v0.6.0#setting-up-workload-identity-federation
permissions:
contents: read
id-token: write
deployments: write # Allows removing deployments on GitHub

jobs:
teardown_deployment:
name: Teardown deployment
runs-on: ubuntu-latest
env:
GOOGLE_CLOUD_SQL_INSTANCE: sepomex

steps:
# actions/checkout MUST come before auth
- name: Checkout the code
uses: actions/checkout@v3.1.0

- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v0.8.0
with:
service_account: github-actions@sepomex-365521.iam.gserviceaccount.com
workload_identity_provider: projects/582875546495/locations/global/workloadIdentityPools/github-pool/providers/github-provider

- name: Set up gcloud Cloud SDK environment
uses: google-github-actions/setup-gcloud@v0.6.0

# - name: Drop the review bucket
# run: |-
# gcloud storage rm --recursive \
# gs://sepomex-pr${{ github.event.pull_request.number }}-bucket \
# --quiet

- name: Drop the review database
run: |-
gcloud sql databases delete \
sepomex_pr${{ github.event.pull_request.number }} \
--quiet \
--instance=${{ env.GOOGLE_CLOUD_SQL_INSTANCE }}
- name: Remove the deployed services from Cloud Run
run: |-
gcloud run services delete \
sepomex-pr${{ github.event.pull_request.number }} \
--quiet \
--platform=managed \
--region=us-central1
- name: Deactivate & remove the deployment from Github
uses: bobheadxi/deployments@v1.3.0
if: always()
with:
step: delete-env
token: ${{ github.token }}
env: ${{ github.head_ref }}

0 comments on commit cc169e3

Please sign in to comment.