From 3b92c63ccc5d860b9372fbeb2857fcf623514642 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 16:02:22 -0400 Subject: [PATCH 01/21] feat: Deploy --- .github/workflows/push.yml | 40 ++++++++++++++++++++++++++++++++++++++ Makefile | 34 ++++++++++++++++++++++++++++++++ gcp/.gcloudignore | 1 + 3 files changed, 75 insertions(+) create mode 100644 .github/workflows/push.yml create mode 100644 Makefile create mode 100644 gcp/.gcloudignore diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 000000000..1f1c8db52 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,40 @@ +name: Push + +on: + push: + branches: + - master + +jobs: + test: + name: Deploy + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install repository + run: npm ci + - name: Run tests + run: npm test + # Commenting out until Codecov is set up + # - name: Upload coverage reports to Codecov + # uses: codecov/codecov-action@v4.2.0 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # verbose: true + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + with: + project_id: policyengine-app-v2 + - name: "Authenticate to Google Cloud" + uses: "google-github-actions/auth@v2" + with: + workload_identity_provider: "projects/83599293185/locations/global/workloadIdentityPools/prod-github-provider/providers/prod-github-provider" + service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" + - name: Deploy + run: make deploy \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..cadae6497 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +REACT_APP_DEBUG ?= false + +install: + npm ci + pip3 install -U black + +build: + npm run build + +debug-no-lint: + ESLINT_NO_DEV_ERRORS=true npm start + +debug: + REACT_APP_DEBUG=true npm start + +test: + node metadata_fetch.mjs + npm run test + +deploy-setup: + cp gcp/.gcloudignore ./.gcloudignore + cp gcp/app.yaml ./app.yaml + cp gcp/main.py ./main.py + cp gcp/social_card_tags.py ./social_card_tags.py + cp gcp/requirements.txt ./requirements.txt + cp -r social_cards/ build/static/media/social_cards + +deploy: build + gcloud config set app/cloud_build_timeout 1000 + y | gcloud app deploy --project policyengine-app + +format: + black . -l 79 + npm run fix \ No newline at end of file diff --git a/gcp/.gcloudignore b/gcp/.gcloudignore new file mode 100644 index 000000000..40b878db5 --- /dev/null +++ b/gcp/.gcloudignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file From e80091b4cfcfa902a6ad04e1cc193948d39685ab Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 16:03:30 -0400 Subject: [PATCH 02/21] test: Test deployment on PR --- .github/workflows/push.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 1f1c8db52..2bd7c4662 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,9 +1,10 @@ -name: Push +name: PR on: - push: + pull_request: branches: - master + - feat/deploy jobs: test: From 614363ebeb1d65a713347d38d9bc51c7ee140364 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 16:09:49 -0400 Subject: [PATCH 03/21] fix: Reorder actions --- .github/workflows/push.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 2bd7c4662..05474b8eb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -28,14 +28,14 @@ jobs: # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # with: # verbose: true - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v1 - with: - project_id: policyengine-app-v2 - name: "Authenticate to Google Cloud" uses: "google-github-actions/auth@v2" with: workload_identity_provider: "projects/83599293185/locations/global/workloadIdentityPools/prod-github-provider/providers/prod-github-provider" service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v1 + with: + project_id: policyengine-app-v2 - name: Deploy run: make deploy \ No newline at end of file From c107600c745cb1758c9c34ecb111fcee1e8198be Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 16:12:20 -0400 Subject: [PATCH 04/21] fix: Add necessary permissions --- .github/workflows/push.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 05474b8eb..60711dd37 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -10,6 +10,9 @@ jobs: test: name: Deploy runs-on: ubuntu-latest + permissions: + contents: "read" + id-token: "write" steps: - name: Checkout repo uses: actions/checkout@v4 From aa725a3bf5774243cc29a126b143055ba4f8856a Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 18:44:55 -0400 Subject: [PATCH 05/21] fix: Change to Node for deployment --- .github/workflows/push.yml | 76 ++++++++++++++++++++------------------ Makefile | 34 ----------------- app.yaml | 49 ++++++++++++++++++++++++ gcp/.gcloudignore | 1 - 4 files changed, 89 insertions(+), 71 deletions(-) delete mode 100644 Makefile create mode 100644 app.yaml delete mode 100644 gcp/.gcloudignore diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 60711dd37..c6e293f04 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,44 +1,48 @@ -name: PR +name: Deploy to App Engine on: - pull_request: + pull_request: # For testing purposes; will be changed to push later branches: - master - - feat/deploy + - feat/deploy # For testing purposes; will be changed later + +permissions: + id-token: write + contents: read jobs: - test: - name: Deploy + deploy: runs-on: ubuntu-latest - permissions: - contents: "read" - id-token: "write" + steps: - - name: Checkout repo - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.11" - - name: Install repository - run: npm ci - - name: Run tests - run: npm test - # Commenting out until Codecov is set up - # - name: Upload coverage reports to Codecov - # uses: codecov/codecov-action@v4.2.0 - # env: - # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - # with: - # verbose: true - - name: "Authenticate to Google Cloud" - uses: "google-github-actions/auth@v2" - with: - workload_identity_provider: "projects/83599293185/locations/global/workloadIdentityPools/prod-github-provider/providers/prod-github-provider" - service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@v1 - with: - project_id: policyengine-app-v2 - - name: Deploy - run: make deploy \ No newline at end of file + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Build application + run: npm run build + + - name: Authenticate to Google Cloud + uses: google-github-actions/auth@v2 + with: + workload_identity_provider: "projects/83599293185/locations/global/workloadIdentityPools/prod-github-provider/providers/prod-github-provider" + service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" + + - name: Set up Cloud SDK + uses: google-github-actions/setup-gcloud@v2 + with: + project_id: policyengine-app-v2 + + - name: Deploy to App Engine + run: gcloud app deploy --quiet --project policyengine-app-v2 \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index cadae6497..000000000 --- a/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -REACT_APP_DEBUG ?= false - -install: - npm ci - pip3 install -U black - -build: - npm run build - -debug-no-lint: - ESLINT_NO_DEV_ERRORS=true npm start - -debug: - REACT_APP_DEBUG=true npm start - -test: - node metadata_fetch.mjs - npm run test - -deploy-setup: - cp gcp/.gcloudignore ./.gcloudignore - cp gcp/app.yaml ./app.yaml - cp gcp/main.py ./main.py - cp gcp/social_card_tags.py ./social_card_tags.py - cp gcp/requirements.txt ./requirements.txt - cp -r social_cards/ build/static/media/social_cards - -deploy: build - gcloud config set app/cloud_build_timeout 1000 - y | gcloud app deploy --project policyengine-app - -format: - black . -l 79 - npm run fix \ No newline at end of file diff --git a/app.yaml b/app.yaml new file mode 100644 index 000000000..f3efdcbfa --- /dev/null +++ b/app.yaml @@ -0,0 +1,49 @@ +runtime: nodejs20 + +handlers: +# Vite builds assets with hashed filenames in /assets/ +- url: /assets + static_dir: dist/assets + secure: always + expiration: "1y" + +# Common static files +- url: /favicon.ico + static_files: dist/favicon.ico + upload: dist/favicon.ico + secure: always + +- url: /manifest.json + static_files: dist/manifest.json + upload: dist/manifest.json + secure: always + +# Any other static files in dist root +- url: /(.+\.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot))$ + static_files: dist/\1 + upload: dist/(.+\.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot))$ + secure: always + expiration: "1y" + +# Handle React Router - serve index.html for all other routes +- url: /.* + static_files: dist/index.html + upload: dist/index.html + secure: always + +# Skip unnecessary files +skip_files: +- node_modules/ +- src/ +- public/ +- "*.md" +- "*.json" +- "*.ts" +- "*.tsx" +- ".git/" +- ".github/" +- Makefile + +automatic_scaling: + min_instances: 0 + max_instances: 5 \ No newline at end of file diff --git a/gcp/.gcloudignore b/gcp/.gcloudignore deleted file mode 100644 index 40b878db5..000000000 --- a/gcp/.gcloudignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ \ No newline at end of file From 43a9e607d3b6272f81d525815f1ef6440053fbee Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 18:47:43 -0400 Subject: [PATCH 06/21] fix: Change static file cache expiration date to correct format --- app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.yaml b/app.yaml index f3efdcbfa..344f375a2 100644 --- a/app.yaml +++ b/app.yaml @@ -5,7 +5,7 @@ handlers: - url: /assets static_dir: dist/assets secure: always - expiration: "1y" + expiration: "365d" # Common static files - url: /favicon.ico From 1725619194d515b61555388bb21135a0c19f78bf Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 18:49:10 -0400 Subject: [PATCH 07/21] fix: Correct expiration date for static files --- app.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.yaml b/app.yaml index 344f375a2..cd0bb59ef 100644 --- a/app.yaml +++ b/app.yaml @@ -23,7 +23,7 @@ handlers: static_files: dist/\1 upload: dist/(.+\.(js|css|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot))$ secure: always - expiration: "1y" + expiration: "365d" # Handle React Router - serve index.html for all other routes - url: /.* From aae654622a5dce57c9f919e0ed57f8d4928e0af3 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 18:56:41 -0400 Subject: [PATCH 08/21] fix: Fix skip_files entry --- app.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app.yaml b/app.yaml index cd0bb59ef..4afcbbc53 100644 --- a/app.yaml +++ b/app.yaml @@ -34,15 +34,14 @@ handlers: # Skip unnecessary files skip_files: - node_modules/ -- src/ -- public/ -- "*.md" -- "*.json" -- "*.ts" -- "*.tsx" -- ".git/" -- ".github/" -- Makefile +- src/ # Source files (Vite builds to dist/) +- ^(.*/)?\..*$ # Hidden files (starting with .) +- ^(.*/)?.*\.md$ # Markdown files +- ^(.*/)?.*\.ts$ # TypeScript files +- ^(.*/)?.*\.tsx$ # TypeScript React files +- ^(.*/)?Makefile$ # Makefile +- ^\.git/ # .git directory +- ^\.github/ # .github directory automatic_scaling: min_instances: 0 From 3e3c0b610754f1199594c87082dc619e1bad4e84 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 18:59:58 -0400 Subject: [PATCH 09/21] fix: Move skip_files to gcloudignore --- .gcloudignore | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ app.yaml | 12 ---------- 2 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 .gcloudignore diff --git a/.gcloudignore b/.gcloudignore new file mode 100644 index 000000000..583023d56 --- /dev/null +++ b/.gcloudignore @@ -0,0 +1,65 @@ +# This file specifies files that are *not* uploaded to Google Cloud +# using gcloud. It follows the same syntax as .gitignore, with the addition of +# "#!include" directives (which insert the entries of the given .gitignore-style +# file at that point). +# +# For more information, run: +# $ gcloud topic gcloudignore +# +.gcloudignore +# If you would like to upload your .git directory, .gitignore file or files +# from your .gitignore file, remove the corresponding line +# below: +.git +.gitignore + +# Node.js dependencies: +node_modules/ + +# Source files (we only need the built dist/ directory) +src/ +public/ + +# Development files +*.md +*.ts +*.tsx +tsconfig.json +vite.config.ts +vitest.config.ts +postcss.config.js +eslint.config.js +.eslintrc* +.prettierrc* +.stylelintrc* + +# Build tools +Makefile +package-lock.json + +# IDE files +.vscode/ +.idea/ +*.swp +*.swo + +# OS files +.DS_Store +Thumbs.db + +# GitHub Actions +.github/ + +# Test files +**/*.test.* +**/*.spec.* +__tests__/ +coverage/ + +# Storybook +.storybook/ +storybook-static/ + +# Environment files +.env* +!.env.example \ No newline at end of file diff --git a/app.yaml b/app.yaml index 4afcbbc53..bf0521834 100644 --- a/app.yaml +++ b/app.yaml @@ -31,18 +31,6 @@ handlers: upload: dist/index.html secure: always -# Skip unnecessary files -skip_files: -- node_modules/ -- src/ # Source files (Vite builds to dist/) -- ^(.*/)?\..*$ # Hidden files (starting with .) -- ^(.*/)?.*\.md$ # Markdown files -- ^(.*/)?.*\.ts$ # TypeScript files -- ^(.*/)?.*\.tsx$ # TypeScript React files -- ^(.*/)?Makefile$ # Makefile -- ^\.git/ # .git directory -- ^\.github/ # .github directory - automatic_scaling: min_instances: 0 max_instances: 5 \ No newline at end of file From 9b1d1cdfc390d815ffe5bc6e8e171edf0913f200 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 20:47:14 -0400 Subject: [PATCH 10/21] fix: Use workflow service account when deploying --- .github/workflows/push.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c6e293f04..4ef5f75f8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -43,6 +43,9 @@ jobs: uses: google-github-actions/setup-gcloud@v2 with: project_id: policyengine-app-v2 + service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" - name: Deploy to App Engine - run: gcloud app deploy --quiet --project policyengine-app-v2 \ No newline at end of file + run: gcloud app deploy --quiet --project policyengine-app-v2 + with: + service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" \ No newline at end of file From 4f4de75d67ab32dda70be71d02eb6ec09a64d7e5 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 20:53:44 -0400 Subject: [PATCH 11/21] fix: List service account in app.yaml --- .github/workflows/push.yml | 5 +---- app.yaml | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4ef5f75f8..c6e293f04 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -43,9 +43,6 @@ jobs: uses: google-github-actions/setup-gcloud@v2 with: project_id: policyengine-app-v2 - service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" - name: Deploy to App Engine - run: gcloud app deploy --quiet --project policyengine-app-v2 - with: - service_account: "workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com" \ No newline at end of file + run: gcloud app deploy --quiet --project policyengine-app-v2 \ No newline at end of file diff --git a/app.yaml b/app.yaml index bf0521834..3b8974575 100644 --- a/app.yaml +++ b/app.yaml @@ -1,5 +1,7 @@ runtime: nodejs20 +service_account: workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com + handlers: # Vite builds assets with hashed filenames in /assets/ - url: /assets From 79c453c0b8e136ae24ca5b6e16141a516217503b Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 21:00:33 -0400 Subject: [PATCH 12/21] fix: Attempt having OIDC account impersonate standard deploy account --- app.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/app.yaml b/app.yaml index 3b8974575..bf0521834 100644 --- a/app.yaml +++ b/app.yaml @@ -1,7 +1,5 @@ runtime: nodejs20 -service_account: workflow-identity-provider@policyengine-app-v2.iam.gserviceaccount.com - handlers: # Vite builds assets with hashed filenames in /assets/ - url: /assets From 6d68553d5e4ba1520c3b03536968914622119c02 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 21:14:52 -0400 Subject: [PATCH 13/21] fix: Properly build TypeScript artifact and deploy --- package.json | 2 +- tsconfig.build.json | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index 2cbea2eab..3b5a8c5df 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "version": "0.0.0", "scripts": { "dev": "vite", - "build": "tsc && vite build", + "build": "tsc -p tsconfig.build.json && vite build", "preview": "vite preview", "typecheck": "tsc --noEmit", "lint": "npm run eslint && npm run stylelint", diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 000000000..5dd22476e --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": false, + "outDir": "./build-ts", + "declaration": true, + "declarationMap": true, + "sourceMap": true + }, + "exclude": ["**/*.test.*", "**/*.spec.*", "test-utils", "vitest.config.ts"] +} \ No newline at end of file From 17037ad84924a8f3efb6069fca9f8f4d94284df0 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 21:22:35 -0400 Subject: [PATCH 14/21] fix: Use TS to typecheck, use Vite to build --- .gcloudignore | 6 +++--- app.yaml | 3 +++ package.json | 3 ++- tsconfig.build.json | 11 ----------- 4 files changed, 8 insertions(+), 15 deletions(-) delete mode 100644 tsconfig.build.json diff --git a/.gcloudignore b/.gcloudignore index 583023d56..3b9676639 100644 --- a/.gcloudignore +++ b/.gcloudignore @@ -16,11 +16,11 @@ # Node.js dependencies: node_modules/ -# Source files (we only need the built dist/ directory) +# Source files - we only need the built dist/ directory src/ public/ -# Development files +# Development and config files *.md *.ts *.tsx @@ -33,7 +33,7 @@ eslint.config.js .prettierrc* .stylelintrc* -# Build tools +# Build tools and scripts Makefile package-lock.json diff --git a/app.yaml b/app.yaml index bf0521834..779824dcf 100644 --- a/app.yaml +++ b/app.yaml @@ -1,5 +1,8 @@ runtime: nodejs20 +env_variables: + GOOGLE_NODE_RUN_SCRIPTS: "" + handlers: # Vite builds assets with hashed filenames in /assets/ - url: /assets diff --git a/package.json b/package.json index 3b5a8c5df..fed7b3c90 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "version": "0.0.0", "scripts": { "dev": "vite", - "build": "tsc -p tsconfig.build.json && vite build", + "build": "vite build", + "build-with-types": "tsc --noEmit && vite build", "preview": "vite preview", "typecheck": "tsc --noEmit", "lint": "npm run eslint && npm run stylelint", diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 5dd22476e..000000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": false, - "outDir": "./build-ts", - "declaration": true, - "declarationMap": true, - "sourceMap": true - }, - "exclude": ["**/*.test.*", "**/*.spec.*", "test-utils", "vitest.config.ts"] -} \ No newline at end of file From 47b9e2233922b9061ff2bb2977e241ecabcb1080 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 21:35:25 -0400 Subject: [PATCH 15/21] test: Try to explicitly build app via GH Actions, then upload just dist to GCP --- .gcloudignore | 69 ++++---------------------------------- .github/workflows/push.yml | 17 ++++++---- 2 files changed, 17 insertions(+), 69 deletions(-) diff --git a/.gcloudignore b/.gcloudignore index 3b9676639..f5c1ed746 100644 --- a/.gcloudignore +++ b/.gcloudignore @@ -1,65 +1,8 @@ # This file specifies files that are *not* uploaded to Google Cloud -# using gcloud. It follows the same syntax as .gitignore, with the addition of -# "#!include" directives (which insert the entries of the given .gitignore-style -# file at that point). -# -# For more information, run: -# $ gcloud topic gcloudignore -# -.gcloudignore -# If you would like to upload your .git directory, .gitignore file or files -# from your .gitignore file, remove the corresponding line -# below: -.git -.gitignore +# Only upload app.yaml and the built dist/ directory -# Node.js dependencies: -node_modules/ - -# Source files - we only need the built dist/ directory -src/ -public/ - -# Development and config files -*.md -*.ts -*.tsx -tsconfig.json -vite.config.ts -vitest.config.ts -postcss.config.js -eslint.config.js -.eslintrc* -.prettierrc* -.stylelintrc* - -# Build tools and scripts -Makefile -package-lock.json - -# IDE files -.vscode/ -.idea/ -*.swp -*.swo - -# OS files -.DS_Store -Thumbs.db - -# GitHub Actions -.github/ - -# Test files -**/*.test.* -**/*.spec.* -__tests__/ -coverage/ - -# Storybook -.storybook/ -storybook-static/ - -# Environment files -.env* -!.env.example \ No newline at end of file +# Exclude ALL source and config files +* +!app.yaml +!dist/ +!dist/** \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c6e293f04..d902a353f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,10 +1,10 @@ name: Deploy to App Engine on: - pull_request: # For testing purposes; will be changed to push later - branches: + push: + branches: - master - - feat/deploy # For testing purposes; will be changed later + - feat/deploy permissions: id-token: write @@ -27,11 +27,16 @@ jobs: - name: Install dependencies run: npm ci - - name: Run tests + - name: Run tests (includes type checking) run: npm test - - name: Build application - run: npm run build + - name: Build application with Vite + run: | + npm run build + echo "Build completed. Contents of dist/:" + ls -la dist/ + echo "Verifying index.html exists:" + test -f dist/index.html && echo "✓ index.html found" || echo "✗ index.html missing" - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 From feb75d39e7e1aa5900e78c2c1c45f36f95c89ded Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 21:58:30 -0400 Subject: [PATCH 16/21] chore: Refactor multiline launch scripts into shell files --- .github/workflows/push.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d902a353f..f7ee5d0e5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -2,9 +2,7 @@ name: Deploy to App Engine on: push: - branches: - - master - - feat/deploy + branches: [master] permissions: id-token: write @@ -31,12 +29,7 @@ jobs: run: npm test - name: Build application with Vite - run: | - npm run build - echo "Build completed. Contents of dist/:" - ls -la dist/ - echo "Verifying index.html exists:" - test -f dist/index.html && echo "✓ index.html found" || echo "✗ index.html missing" + run: ../scripts/build-with-vite.sh - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 From bc72542b6b18742a5d54b0ae3846c65ef9429ddf Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 22:00:19 -0400 Subject: [PATCH 17/21] test: Deploy with script changes --- .github/scripts/build-with-vite.sh | 8 ++++++++ .github/workflows/push.yml | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .github/scripts/build-with-vite.sh diff --git a/.github/scripts/build-with-vite.sh b/.github/scripts/build-with-vite.sh new file mode 100644 index 000000000..ad56cf54a --- /dev/null +++ b/.github/scripts/build-with-vite.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +echo "Starting build process with Vite..." +npm run build +echo "Build completed. Contents of dist/:" +ls -la dist/ +echo "Verifying index.html exists:" +test -f dist/index.html && echo "✓ index.html found" || echo "✗ index.html missing" \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index f7ee5d0e5..0ade09efb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,8 +1,10 @@ name: Deploy to App Engine on: - push: - branches: [master] + pull_request: + branches: + - master + - feat/deploy permissions: id-token: write From 721b4fb98a5cf411d31c44a59e3511d34b4f53e0 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 22:03:04 -0400 Subject: [PATCH 18/21] fix: Update script path --- .github/scripts/build-with-vite.sh | 0 .github/workflows/push.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 .github/scripts/build-with-vite.sh diff --git a/.github/scripts/build-with-vite.sh b/.github/scripts/build-with-vite.sh old mode 100644 new mode 100755 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 0ade09efb..c0c2bc4a3 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -31,7 +31,7 @@ jobs: run: npm test - name: Build application with Vite - run: ../scripts/build-with-vite.sh + run: .github/scripts/build-with-vite.sh - name: Authenticate to Google Cloud uses: google-github-actions/auth@v2 From 6baec9bc17cfdfa773141aa056848f8176488515 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 22:06:20 -0400 Subject: [PATCH 19/21] fix: Remove testing code from push.yaml --- .github/workflows/push.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index c0c2bc4a3..7994c423a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,10 +1,9 @@ name: Deploy to App Engine on: - pull_request: + push: branches: - master - - feat/deploy permissions: id-token: write From a2103b6b8d56eeacca58a9ebc01edeac93ab7502 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 22:07:44 -0400 Subject: [PATCH 20/21] feat: Add tests on PR, as well as push --- .../workflows/{npm_test.yml => npm_test.yaml} | 0 .github/workflows/pull_request.yaml | 27 +++++++++++++++++++ .github/workflows/{push.yml => push.yaml} | 0 3 files changed, 27 insertions(+) rename .github/workflows/{npm_test.yml => npm_test.yaml} (100%) create mode 100644 .github/workflows/pull_request.yaml rename .github/workflows/{push.yml => push.yaml} (100%) diff --git a/.github/workflows/npm_test.yml b/.github/workflows/npm_test.yaml similarity index 100% rename from .github/workflows/npm_test.yml rename to .github/workflows/npm_test.yaml diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml new file mode 100644 index 000000000..e8adedaee --- /dev/null +++ b/.github/workflows/pull_request.yaml @@ -0,0 +1,27 @@ +name: Test + +on: + pull_request: + branches: + - '**' + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests (includes type checking) + run: npm test + \ No newline at end of file diff --git a/.github/workflows/push.yml b/.github/workflows/push.yaml similarity index 100% rename from .github/workflows/push.yml rename to .github/workflows/push.yaml From 02e2144a4b95579cb07496b0d362e606ac34109a Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 8 Jul 2025 22:10:11 -0400 Subject: [PATCH 21/21] fix: Separate deploy and test --- .github/workflows/pull_request.yaml | 2 +- .github/workflows/push.yaml | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index e8adedaee..9982fe1ff 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -6,7 +6,7 @@ on: - '**' jobs: - deploy: + test: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 7994c423a..d972d329e 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -10,7 +10,7 @@ permissions: contents: read jobs: - deploy: + test: runs-on: ubuntu-latest steps: @@ -29,6 +29,23 @@ jobs: - name: Run tests (includes type checking) run: npm test + deploy: + runs-on: ubuntu-latest + needs: test + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + - name: Build application with Vite run: .github/scripts/build-with-vite.sh