Run Pytest with Google Cloud Function
Fork this repo and create a Codespace.
gcloud auth application-default loginPlace your student list in admin_tools/Namelist.xlsx (you can use admin_tools/Namelist_template.xlsx as a template).
- The Excel sheet should contain columns:
Student NoandStudent Name. admin_tools/Namelist.xlsxis git-ignored and will not be committed to GitHub.- CDKTF will automatically sync and package this file into the
scorereportCloud Function bundle during deployment.
Copy cdktf/.env.template to cdktf/.env and configure the project ID, billing account, region, and prefix.
STACK_NAME is optional and defaults to cdktf, preserving the existing stack identity and local state file.
./deploy.sh For a separate deployment, use both a new, globally unique project ID and a distinct stack name:
PROJECTID=my-pytest-runner-dev STACK_NAME=pytest-runner-dev ./deploy.shKeep the original project ID, stack name, and local Terraform state when updating an existing deployment. Changing only the project ID while reusing a stack's state can propose replacing existing resources. Changing the stack name does not migrate its state. Local state files are not committed to this repository.
Record down the output values:
api-url: API Gateway domainproject-id: Google Cloud Project IDservice-name: Managed API service namereport-website-url: Static website URL hosting the student score reportreport-function-url: Score report Cloud Function endpoint
Set project:
gcloud auth login
gcloud config set project <project-id>
gcloud auth application-default set-quota-project <project-id>
gcloud services enable <service-name>Firestore database creation can succeed while the provider's immediate metadata read returns a 403, leaving the database tainted in Terraform state. This is tracked in hashicorp/terraform-provider-google#30496. Inspect the existing database and Terraform plan before retrying; do not blindly approve database replacement. The function deployment-order fix prevents concurrent source-bucket initialization but does not resolve this separate Firestore failure.
A set of Python scripts for API key management and report generation.
gcloud auth login
gcloud config set project <project-id>
gcloud auth application-default set-quota-project <project-id>