Skip to content

ci: build and upload prebuilt assets on push - #2372

Open
AryamanSharma14 wants to merge 1 commit into
frappe:developfrom
AryamanSharma14:ci/prebuilt-assets
Open

ci: build and upload prebuilt assets on push#2372
AryamanSharma14 wants to merge 1 commit into
frappe:developfrom
AryamanSharma14:ci/prebuilt-assets

Conversation

@AryamanSharma14

Copy link
Copy Markdown

Builds JS/CSS + the Vue SPA on push to develop/main/version-* and uploads them as a rolling assets-<branch> release, so benches can download prebuilt assets instead of building from source. Same setup as frappe/erpnext/hrms.

Build JS/CSS + the Vue SPA on every push to develop/main/version-*,
package the app's public/ output into crm-assets.tar.gz, and upload
it to a rolling assets-<branch> prerelease. Lets bench tooling download
prebuilt assets instead of building from source on every setup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mergify

mergify Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5

The new workflow can fail before producing assets on normal branch pushes.

  • The Frappe checkout assumes a same-named upstream branch.
  • The CRM install step skips the frontend/ dependencies used by the SPA build.
  • The release upload path can mis-map branch assets or leave the rolling asset missing during interrupted uploads.

.github/workflows/build-and-commit-assets.yml

Important Files Changed

Filename Overview
.github/workflows/build-and-commit-assets.yml Adds the rolling asset build/upload workflow; branch checkout, dependency install, and release upload paths need fixes.
Prompt To Fix All With AI
Fix the following 5 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 5
.github/workflows/build-and-commit-assets.yml:31
**Frappe Ref Can Be Missing**

A push to `main` or a `version-*` CRM branch checks out `frappe/frappe` with the same branch name. Existing workflow patterns map CRM branches to Frappe branches instead; when the matching Frappe ref is absent, this checkout fails and no asset release is produced.

### Issue 2 of 5
.github/workflows/build-and-commit-assets.yml:57
**Frontend Dependencies Stay Uninstalled**

This install runs at the CRM repo root, but the Vue app dependencies and real lockfile live under `frontend/`. The later root `yarn build` only runs `cd frontend && yarn build`, so a fresh runner reaches the SPA build without `frontend/node_modules` and fails on missing Vite/Vue packages.

### Issue 3 of 5
.github/workflows/build-and-commit-assets.yml:81
**Branch Tag Mapping Collides**

The tag name replaces `/` with `-`, so two valid matching branches such as `version-15/hotfix` and `version-15-hotfix` both upload to `assets-version-15-hotfix`. Those pushes can overwrite each other's rolling asset, leaving benches with assets from the wrong branch.

### Issue 4 of 5
.github/workflows/build-and-commit-assets.yml:82
**Release Tag Uses Default Branch**

On the first upload for a branch, `gh release create` is called without `--target`, so GitHub creates the missing tag from the repository default branch rather than the pushed SHA. The uploaded tarball can then contain assets built from one branch while the release tag points at a different commit.

### Issue 5 of 5
.github/workflows/build-and-commit-assets.yml:83
**Cancelled Upload Can Drop Asset**

Rapid pushes to the same branch cancel the older run, and `gh release upload --clobber` deletes the existing asset before uploading the replacement. If cancellation lands during that command, the rolling release can be left without `crm-assets.tar.gz`, so benches cannot download prebuilt assets.

Reviews (1): Last reviewed commit: "ci: build and upload assets to rolling r..." | Re-trigger Greptile

- uses: actions/checkout@v4
with:
repository: frappe/frappe
path: apps/frappe

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Frappe Ref Can Be Missing

A push to main or a version-* CRM branch checks out frappe/frappe with the same branch name. Existing workflow patterns map CRM branches to Frappe branches instead; when the matching Frappe ref is absent, this checkout fails and no asset release is produced.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 31

Comment:
**Frappe Ref Can Be Missing**

A push to `main` or a `version-*` CRM branch checks out `frappe/frappe` with the same branch name. Existing workflow patterns map CRM branches to Frappe branches instead; when the matching Frappe ref is absent, this checkout fails and no asset release is produced.

**Context Used:** AGENTS.md ([source](https://app.greptile.com/frappe/github/frappe/crm/-/custom-context?memory=242c238f-7e68-48c9-88da-fba50847b5c5))

How can I resolve this? If you propose a fix, please make it concise.


- name: Install crm JS dependencies
working-directory: apps/crm
run: yarn install --frozen-lockfile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Frontend Dependencies Stay Uninstalled

This install runs at the CRM repo root, but the Vue app dependencies and real lockfile live under frontend/. The later root yarn build only runs cd frontend && yarn build, so a fresh runner reaches the SPA build without frontend/node_modules and fails on missing Vite/Vue packages.

Context Used: AGENTS.md (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 57

Comment:
**Frontend Dependencies Stay Uninstalled**

This install runs at the CRM repo root, but the Vue app dependencies and real lockfile live under `frontend/`. The later root `yarn build` only runs `cd frontend && yarn build`, so a fresh runner reaches the SPA build without `frontend/node_modules` and fails on missing Vite/Vue packages.

**Context Used:** AGENTS.md ([source](https://app.greptile.com/frappe/github/frappe/crm/-/custom-context?memory=242c238f-7e68-48c9-88da-fba50847b5c5))

How can I resolve this? If you propose a fix, please make it concise.

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="assets-${GITHUB_REF_NAME//\//-}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Branch Tag Mapping Collides

The tag name replaces / with -, so two valid matching branches such as version-15/hotfix and version-15-hotfix both upload to assets-version-15-hotfix. Those pushes can overwrite each other's rolling asset, leaving benches with assets from the wrong branch.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 81

Comment:
**Branch Tag Mapping Collides**

The tag name replaces `/` with `-`, so two valid matching branches such as `version-15/hotfix` and `version-15-hotfix` both upload to `assets-version-15-hotfix`. Those pushes can overwrite each other's rolling asset, leaving benches with assets from the wrong branch.

How can I resolve this? If you propose a fix, please make it concise.

GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="assets-${GITHUB_REF_NAME//\//-}"
gh release create "$TAG" -R "$GITHUB_REPOSITORY" --prerelease --title "Assets: $GITHUB_REF_NAME" --notes "" 2>/dev/null || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Release Tag Uses Default Branch

On the first upload for a branch, gh release create is called without --target, so GitHub creates the missing tag from the repository default branch rather than the pushed SHA. The uploaded tarball can then contain assets built from one branch while the release tag points at a different commit.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 82

Comment:
**Release Tag Uses Default Branch**

On the first upload for a branch, `gh release create` is called without `--target`, so GitHub creates the missing tag from the repository default branch rather than the pushed SHA. The uploaded tarball can then contain assets built from one branch while the release tag points at a different commit.

How can I resolve this? If you propose a fix, please make it concise.

run: |
TAG="assets-${GITHUB_REF_NAME//\//-}"
gh release create "$TAG" -R "$GITHUB_REPOSITORY" --prerelease --title "Assets: $GITHUB_REF_NAME" --notes "" 2>/dev/null || true
gh release upload "$TAG" -R "$GITHUB_REPOSITORY" crm-assets.tar.gz --clobber

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Cancelled Upload Can Drop Asset

Rapid pushes to the same branch cancel the older run, and gh release upload --clobber deletes the existing asset before uploading the replacement. If cancellation lands during that command, the rolling release can be left without crm-assets.tar.gz, so benches cannot download prebuilt assets.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/build-and-commit-assets.yml
Line: 83

Comment:
**Cancelled Upload Can Drop Asset**

Rapid pushes to the same branch cancel the older run, and `gh release upload --clobber` deletes the existing asset before uploading the replacement. If cancellation lands during that command, the rolling release can be left without `crm-assets.tar.gz`, so benches cannot download prebuilt assets.

How can I resolve this? If you propose a fix, please make it concise.

@codecov-commenter

codecov-commenter commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.53%. Comparing base (c2a9d4c) to head (75593fd).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #2372      +/-   ##
===========================================
- Coverage    60.56%   60.53%   -0.03%     
===========================================
  Files          142      142              
  Lines         8550     8550              
===========================================
- Hits          5178     5176       -2     
- Misses        3372     3374       +2     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants