Repository navigation
FE-2218 ci: run the billing-web unit tests on pull requests #17827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # Description: Unit tests + coverage reporting for the billing web app | ||
| # (apps/billing-web). The root unit workflow's path filter excludes apps/**. | ||
| name: 'CI: Billing Web Unit' | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches-ignore: [wip/*, draft/*, temp/*] | ||
| merge_group: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| changes: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| app-billing-web-changes: ${{ steps.changes.outputs.app-billing-web-changes }} | ||
| packages-changes: ${{ steps.changes.outputs.packages-changes }} | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - id: changes | ||
| uses: ./.github/actions/changes-filter | ||
|
|
||
| billing-web-unit: | ||
| needs: changes | ||
| if: ${{ needs.changes.outputs.app-billing-web-changes == 'true' || needs.changes.outputs.packages-changes == 'true' }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - name: Setup frontend | ||
| uses: ./.github/actions/setup-frontend | ||
|
|
||
| - name: Run billing web unit tests with coverage | ||
| run: pnpm --filter @comfyorg/billing-web test:coverage | ||
|
|
||
| - name: Upload billing web coverage to Codecov | ||
| if: ${{ !cancelled() }} | ||
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | ||
| with: | ||
| working-directory: ./apps/billing-web | ||
| files: ./coverage/lcov.info | ||
| disable_search: true | ||
| flags: billing-web | ||
| # Re-root LCOV paths to prevent collisions with root-app coverage. | ||
| network_prefix: apps/billing-web/ | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| # Forks have no token, so upload failures cannot block contributors. | ||
| fail_ci_if_error: ${{ github.event.pull_request.head.repo.fork != true }} | ||
|
|
||
| # Stable branch-protection context when tests are skipped. | ||
| billing-web-unit-gate: | ||
| needs: [changes, billing-web-unit] | ||
| if: ${{ always() }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Verify billing web unit tests passed or were not required | ||
| env: | ||
| CHANGES_RESULT: ${{ needs.changes.result }} | ||
| UNIT_RESULT: ${{ needs.billing-web-unit.result }} | ||
| BILLING_WEB_CHANGED: ${{ needs.changes.outputs.app-billing-web-changes }} | ||
| PACKAGES_CHANGED: ${{ needs.changes.outputs.packages-changes }} | ||
| run: | | ||
| if [ "$UNIT_RESULT" = "success" ]; then | ||
| echo "Billing web unit tests passed." | ||
| exit 0 | ||
| fi | ||
| # Pass skipped tests only after successful filtering found no relevant changes. | ||
| if [ "$UNIT_RESULT" = "skipped" ] && | ||
| [ "$CHANGES_RESULT" = "success" ] && | ||
| [ "$BILLING_WEB_CHANGED" != "true" ] && | ||
| [ "$PACKAGES_CHANGED" != "true" ]; then | ||
| echo "No billing web or package changes; billing web unit tests not required." | ||
| exit 0 | ||
| fi | ||
| echo "::error title=Billing web unit tests::changes=$CHANGES_RESULT unit=$UNIT_RESULT billing-web=$BILLING_WEB_CHANGED packages=$PACKAGES_CHANGED" | ||
| exit 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,3 +61,7 @@ flags: | |
| paths: | ||
| - apps/website/src/** | ||
| carryforward: false | ||
| billing-web: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Nothing is lost by doing it now rather than at merge: as your other comment shows, the job has never executed, so no coverage has ever been uploaded under
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed on the convention — It is not in #17844, and only for a mechanical reason. The rename has to move So it needs a push from a
Happy to fold it into #17844 if you or @dante01yoon re-push that branch; otherwise it should get its own PR before more history accrues under |
||
| paths: | ||
| - apps/billing-web/src/** | ||
| carryforward: false | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want matching
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. The follow-up adds
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes — added in #17844. Verified with Codecov's own validator ( |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this filter also list
.github/workflows/ci-billing-web-unit.yaml, the wayapp_websitejust above listsci-website-e2e.yamland its two scripts? The consequence is visible on this very PR: run 35103654522 / 35103654481 showsbilling-web-unitskipped andbilling-web-unit-gatepassing through the skip branch, so the job this PR adds has never executed once. The merge queue would still exercise it before anything lands on main, so this is fine to do as a follow-up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, and the fix is prepared:
app_billing_webalso matches.github/workflows/ci-billing-web-unit.yaml, so a change to the workflow runs the job it defines instead of skipping past it.Not pushed to this branch: the PR is at merge-queue position 1 (enqueued 16:04:18Z) and the branch is push-protected while queued, so landing it here would mean dequeuing and dropping your approval. It goes out as a follow-up PR together with the two codecov points below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes — fixed in #17844, which adds
.github/workflows/ci-billing-web-unit.yamltoapp_billing_web.Your diagnosis holds exactly as written: run 35103654481 shows
billing-web-unitskipped andbilling-web-unit-gategreen through the skip branch, so this PR merged without ever executing the job it added. The first execution was the post-merge push run onmain(35121739924), which ran only because every filter output defaults to'true'offpull_request.One nuance on the precedent you cited:
app_websitelistsci-website-e2e.yaml, but notci-website-unit.yaml. So the existing unit-workflow convention is actually 'do not self-list', and what landed here matched it. I still think self-listing is the right call — the gate is only meaningful if the workflow that defines it is in scope — so #17844 changes billing-web and leavesapp_websitealone rather than quietly altering website CI. Worth the matching one-liner forci-website-unit.yaml, or do you prefer that asymmetry left as-is?