Bump happy-dom and @happy-dom/global-registrator in /components/frontend_react/webapp #49
This file contains hidden or 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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
# copier:raw | |
name: E2E API Tests on GKE Microservices | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "components/**" | |
- "utils/**" | |
- ".github/workflows/e2e_gke_api_test.yaml" | |
workflow_dispatch: | |
env: | |
PROJECT_ID: ${{ vars.PROJECT_ID }} | |
SKAFFOLD_DEFAULT_REPO: gcr.io/${{ vars.PROJECT_ID }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
DOMAIN_NAME: ${{ vars.DOMAIN_NAME }} | |
GKE_CLUSTER: main-cluster | |
GKE_REGION: us-central1 | |
KUSTOMIZE_VERSION: 5.0.0 | |
SKAFFOLD_VERSION: 2.4.0 | |
SKAFFOLD_CACHE_GCS: gs://artifacts.${{ vars.PROJECT_ID }}.appspot.com/skaffold/cache | |
jobs: | |
deploy: | |
name: Deploy all microservices in PR namespace | |
runs-on: ubuntu-latest | |
environment: develop | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- id: auth | |
name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Install gcloud | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
install_components: gke-gcloud-auth-plugin | |
- name: Connect to cluster | |
run: | | |
gcloud container clusters get-credentials "${GKE_CLUSTER}" --region ${GKE_REGION} --project ${PROJECT_ID} | |
- name: Create namespace if it does not exist | |
run: | | |
SKAFFOLD_NAMESPACE=e2e-pr-${PR_NUMBER} | |
echo SKAFFOLD_NAMESPACE=$SKAFFOLD_NAMESPACE | |
kubectl get ns ${SKAFFOLD_NAMESPACE} || kubectl create ns ${SKAFFOLD_NAMESPACE} | |
- name: Set up Service Account | |
run: | | |
SKAFFOLD_NAMESPACE=e2e-pr-${PR_NUMBER} bash setup/setup_ksa.sh | |
- name: Install Kustomize | |
run: | | |
wget -O kustomize.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v$KUSTOMIZE_VERSION/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz | |
sudo tar -xvf kustomize.tar.gz -C /usr/local/bin/ | |
- name: Install Solutions Builder | |
run: | | |
pip install -U solutions-builder | |
- name: Update the project id in config files | |
run: | | |
sb set project-id ${PROJECT_ID} --yes | |
sb vars set domain_name ${DOMAIN_NAME} | |
- name: Install Skaffold release binary | |
run: | | |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v$SKAFFOLD_VERSION/skaffold-linux-amd64 | |
sudo install skaffold /usr/local/bin/skaffold | |
- name: Set default repo for Skaffold | |
run: | | |
skaffold config set default-repo "$SKAFFOLD_DEFAULT_REPO" | |
- name: Download Skaffold cache if exists | |
run: | | |
gsutil cp $SKAFFOLD_CACHE_GCS ~/.skaffold/ || true | |
- name: Build and deploy to cluster | |
run: | | |
SKAFFOLD_NAMESPACE=e2e-pr-${PR_NUMBER} | |
export DATABASE_PREFIX=e2e_pr${PR_NUMBER}_ | |
sb deploy -n ${SKAFFOLD_NAMESPACE} --yes | |
# skaffold run \ | |
# --profile default-deploy \ | |
# --namespace $SKAFFOLD_NAMESPACE \ | |
# -l commit=$GITHUB_SHA \ | |
# --tag PR${{ github.event.pull_request.number }} | |
- name: Upload Skaffold cache | |
if: always() | |
run: | | |
gsutil cp ~/.skaffold/cache ${SKAFFOLD_CACHE_GCS} | |
e2e-api-test: | |
runs-on: ubuntu-latest | |
needs: deploy | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install gcloud | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-custom_exit_code pytest-cov pylint pytest-mock mock | |
python -m pip install -r tests/e2e/requirements.txt | |
- id: auth | |
name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Install gcloud | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
install_components: gke-gcloud-auth-plugin | |
- name: Connect to cluster | |
run: | | |
gcloud container clusters get-credentials "${GKE_CLUSTER}" --region ${GKE_REGION} --project ${PROJECT_ID} | |
- name: Set up port forwarding | |
run: | | |
SKAFFOLD_NAMESPACE=e2e-pr-${PR_NUMBER} | |
python -m pip install -r tests/e2e/requirements.txt | |
python tests/e2e/utils/port_forward.py --namespace $SKAFFOLD_NAMESPACE | |
- name: Cleaning up database | |
run: | | |
cd tests/e2e/utils | |
PYTHONPATH=../../common/src DATABASE_PREFIX=e2e_pr${PR_NUMBER}_ python database_cleanup.py | |
- name: Wait for 5s for database cleaning up | |
run: sleep 5s | |
shell: bash | |
- name: Initialize database | |
run: | | |
cd tests/e2e/utils | |
PYTHONPATH=../../common/src DATABASE_PREFIX=e2e_pr${PR_NUMBER}_ python database_setup.py | |
# - name: Run pytest | |
# run: | | |
# PYTHONPATH=../../common/src DATABASE_PREFIX=e2e_pr${PR_NUMBER}_ python -m pytest tests/e2e/ | |
dataset-cleanup: | |
runs-on: ubuntu-latest | |
needs: e2e-api-test | |
if: always() | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9] | |
steps: | |
- uses: actions/checkout@v3 | |
# https://github.com/google-github-actions/auth | |
- id: "auth" | |
name: Auth with Service Account | |
uses: "google-github-actions/auth@v1" | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
# FIXME: Use workload identity instead of service account key. | |
# workload_identity_provider: '' | |
# service_account: 'deployment-dev@${{ env.PROJECT_ID }}.iam.gserviceaccount.com' | |
- name: Set up Cloud SDK | |
uses: "google-github-actions/setup-gcloud@v1" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest pytest-custom_exit_code pytest-cov pylint pytest-mock mock | |
python -m pip install -r tests/e2e/requirements.txt | |
- name: Cleaning up database | |
run: | | |
cd tests/e2e/utils | |
PYTHONPATH=../../components/common/src DATABASE_PREFIX=e2e_pr${PR_NUMBER}_ python database_cleanup.py | |
deployment-cleanup: | |
name: Clean up deployment in PR namespace | |
needs: e2e-api-test | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install gcloud | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
project_id: ${{env.PROJECT_ID}} | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
export_default_credentials: true | |
- id: auth | |
name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Install gcloud | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
install_components: gke-gcloud-auth-plugin | |
- name: Connect to cluster | |
run: | | |
gcloud container clusters get-credentials "${GKE_CLUSTER}" --region ${GKE_REGION} --project ${PROJECT_ID} | |
- name: Install Kustomize | |
run: | | |
wget -O kustomize.tar.gz https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.0.4/kustomize_v4.0.4_linux_amd64.tar.gz | |
sudo tar -xvf kustomize.tar.gz -C /usr/local/bin/ | |
- name: Install Skaffold release binary | |
run: | | |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/v$SKAFFOLD_VERSION/skaffold-linux-amd64 | |
sudo install skaffold /usr/local/bin/skaffold | |
- name: Set default repo for Skaffold | |
run: | | |
skaffold config set default-repo "$SKAFFOLD_DEFAULT_REPO" | |
- name: Delete all deployments and namespace | |
run: | | |
SKAFFOLD_NAMESPACE=e2e-pr-${PR_NUMBER} | |
skaffold delete --namespace $SKAFFOLD_NAMESPACE | |
kubectl delete namespace $SKAFFOLD_NAMESPACE | |
- name: Remove iam policy binding | |
run: | | |
SKAFFOLD_NAMESPACE=e2e-pr-${PR_NUMBER} | |
gcloud iam service-accounts remove-iam-policy-binding \ | |
--role roles/iam.workloadIdentityUser \ | |
--member "serviceAccount:${PROJECT_ID}.svc.id.goog[${SKAFFOLD_NAMESPACE}/ksa]" \ | |
gke-sa@${PROJECT_ID}.iam.gserviceaccount.com | |
# copier:endraw |