Skip to content

fix: run documentation deployment in parallel with tests - #734

Merged
ooples merged 3 commits into
masterfrom
fix/docs-workflow-parallel
Jan 20, 2026
Merged

ooples merged 3 commits into
masterfrom
fix/docs-workflow-parallel

Conversation

@ooples

@ooples ooples commented Jan 20, 2026

Copy link
Copy Markdown
Owner

Summary

This PR fixes the documentation and Blazor Playground deployment that was broken after PR #731 was merged.

Problem

The previous workflow design had a fundamental flaw:

  • docs.yml triggered via workflow_run only when Build & SonarCloud succeeded
  • If any tests failed or the build was cancelled, documentation never deployed
  • The dawidd6/action-download-artifact action was failing with "Not Found" errors
  • The live site at https://ooples.github.io/AiDotNet only showed an outdated landing page
  • /api/ and /playground/ URLs returned 404

Solution

Architecture Change: Move documentation deployment into sonarcloud.yml to run in parallel with tests:

Build & SonarCloud workflow:
  codeql ─────────────────────────────────────────> (independent)
  build-windows ─┬─> test-net10-sharded (all shards)
                 ├─> size-check
                 └─> build-docs ─> Deploy to GitHub Pages  [NEW]

Key Benefits:

  1. Immediate deployment: Docs deploy as soon as build artifact is available
  2. Independent of tests: Test failures don't block documentation deployment
  3. Guaranteed artifact access: Same workflow, same run = direct artifact access
  4. No third-party action needed: Uses official GitHub Actions only

Changes

  1. .github/workflows/sonarcloud.yml:

    • Added build-docs job that runs in parallel with tests
    • Only deploys on master branch pushes (not PRs)
    • Builds DocFX API documentation
    • Builds Blazor WASM Playground
    • Deploys to GitHub Pages with proper permissions
  2. .github/workflows/docs.yml:

    • Renamed to "Documentation (Manual)"
    • Removed broken workflow_run trigger
    • Kept workflow_dispatch for manual rebuilds
    • Added skip_playground option for faster doc-only rebuilds

Testing

  • Verified DocFX builds locally (5,512 API models, 355 warnings, 0 errors)
  • Verified Blazor Playground builds locally
  • Verified YAML syntax is valid

Test plan

Generated with Claude Code

- Add build-docs job to sonarcloud.yml that runs in parallel with tests
- Documentation deploys immediately after build completes on master
- Remove broken workflow_run trigger from docs.yml
- Keep docs.yml for manual dispatch only with skip_playground option
- Use pinned action versions with SHA hashes for security

This fixes the issue where documentation wasn't deploying because the
workflow_run trigger would skip when Build & SonarCloud had failures.
Now docs deploy as soon as the build artifact is available.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 20, 2026 05:10
@coderabbitai

coderabbitai Bot commented Jan 20, 2026 •

Copy link
Copy Markdown
Contributor

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Summary by CodeRabbit

  • Chores
    • Converted documentation pipeline to a manual "Documentation (Manual)" workflow with a skip_playground option.
    • Improved reliability: caching, updated action/tool versions, and pinned action commits.
    • Simplified build/restore flow and made DocFX steps tolerant to errors.
    • Playground-related steps made conditional; deployment restricted to master and summary links updated to static ooples.io URLs.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Converted the docs workflow to manual workflow_dispatch with a skip_playground input and updated steps/tooling; added a parallel "Build & Deploy Documentation" job in the SonarCloud workflow to build DocFX, optionally build a Blazor Playground, and deploy to GitHub Pages (master-only).

Changes

Cohort / File(s) Summary
Documentation (manual) workflow
\​.github/workflows/docs.yml
Renamed workflow, replaced automatic workflow_run trigger with workflow_dispatch and skip_playground input, added NuGet caching, upgraded/pinned actions, made DocFX step tolerant (continue-on-error), conditionalized Playground restore/publish/copy on skip_playground, and simplified Pages deploy condition to master-only.
Parallel docs job in CI
\​.github/workflows/sonarcloud.yml
Added build-docs job to run alongside Windows build: checkout, setup .NET 10, cache NuGet, install/run DocFX, restore/publish Blazor Playground (conditional), prepare/upload Pages artifact, and deploy to GitHub Pages with concurrency and permissions; appears duplicated in the diff.

Sequence Diagram(s)

sequenceDiagram
    participant Trigger as Trigger (push or manual)
    participant Actions as GitHub Actions
    participant Dotnet as .NET / NuGet
    participant DocFX as DocFX
    participant Playground as Blazor Playground
    participant Pages as GitHub Pages

    Trigger->>Actions: start build-docs job
    Actions->>Dotnet: setup dotnet, restore, cache NuGet
    Actions->>DocFX: install & run docfx build
    alt Playground not skipped
        Actions->>Playground: dotnet publish playground
        Playground-->>Actions: built playground assets
        Actions->>DocFX: copy playground into docs site
    end
    Actions->>Pages: upload artifacts
    Actions->>Pages: deploy to GitHub Pages (master only)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰
Workflows hop from auto to hand,
Docs and Playground take the stand.
I nibble cache and dotnet seeds,
DocFX blooms from CI deeds.
Hooray — the pages now expand!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main architectural change in the PR: moving documentation deployment to run in parallel with tests in the sonarcloud workflow.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the problem, solution, and specific changes to both workflow files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/docs-workflow-parallel

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

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.

Pull request overview

This PR fixes the broken documentation deployment by moving it from a separate workflow_run triggered workflow into the main Build & SonarCloud workflow, allowing documentation to deploy in parallel with tests and independently of test results.

Changes:

  • Moved documentation deployment to run in parallel with tests in the Build & SonarCloud workflow
  • Converted the docs.yml workflow to manual-only with an optional skip_playground parameter for faster doc-only rebuilds
  • Removed the unreliable workflow_run trigger and third-party artifact download action

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/sonarcloud.yml Added new build-docs job that builds DocFX documentation and Blazor playground, then deploys to GitHub Pages on master branch pushes
.github/workflows/docs.yml Converted to manual-only workflow, removed workflow_run trigger, simplified artifact handling, added skip_playground option for faster doc-only rebuilds

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/docs.yml
Comment thread .github/workflows/docs.yml Outdated
Comment thread .github/workflows/sonarcloud.yml Outdated

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/docs.yml:
- Around line 63-78: Replace the fragile boolean negation condition used on the
three playground steps ("Restore Playground dependencies", "Build Blazor WASM
Playground", "Copy Playground to documentation site") and change each if: ${{
!inputs.skip_playground }} to an explicit string comparison if: ${{
inputs.skip_playground != 'true' }} so the workflow reliably skips the
playground when the input is set to 'true'.
🧹 Nitpick comments (2)
.github/workflows/docs.yml (1)

59-61: Prevent deploying an empty docs site if DocFX errors.

continue-on-error: true can allow a failed DocFX run to proceed, and later steps can still create _site. Consider asserting that DocFX produced output before uploading.

🛡️ Suggested guard step
     - name: Build DocFX documentation
       run: docfx docfx.json
       continue-on-error: true  # Don't fail deployment due to docfx warnings

+    - name: Fail if DocFX did not produce site
+      if: ${{ always() }}
+      run: |
+        if [ ! -f _site/index.html ]; then
+          echo "DocFX output missing"; exit 1
+        fi
.github/workflows/sonarcloud.yml (1)

592-595: Guard against DocFX failures before deployment.

With continue-on-error: true, a DocFX failure can still deploy an empty _site (the Playground copy creates the directory). Consider a post-step check to fail if _site/index.html is missing.

🛡️ Suggested guard step
       - name: Build DocFX documentation
         run: docfx docfx.json
         continue-on-error: true  # Don't fail deployment due to docfx warnings

+      - name: Fail if DocFX did not produce site
+        if: ${{ always() }}
+        run: |
+          if [ ! -f _site/index.html ]; then
+            echo "DocFX output missing"; exit 1
+          fi

Comment thread .github/workflows/docs.yml
@sonarqubecloud

Copy link
Copy Markdown

ooples and others added 2 commits January 20, 2026 07:26
- Use explicit boolean comparison for skip_playground input
- Add warning message when deployment skipped on non-master branch
- Conditionally show playground link only when playground was built
- Remove unnecessary artifact download (DocFX builds from source)
- Add comment explaining why artifacts are not downloaded

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ooples
ooples merged commit b8ad599 into master Jan 20, 2026
36 of 37 checks passed
@ooples
ooples deleted the fix/docs-workflow-parallel branch January 20, 2026 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants