diff --git a/.github/workflows/snippets5000.yml b/.github/workflows/snippets5000.yml new file mode 100644 index 00000000..017e5198 --- /dev/null +++ b/.github/workflows/snippets5000.yml @@ -0,0 +1,62 @@ +name: 'Snippets 5000' + +on: + pull_request: + branches: [main] + types: [opened, synchronize, reopened] + workflow_dispatch: + inputs: + pull_request: + description: 'The pull request number to build' + required: true + type: number + +env: + DOTNET_VERSION: '11.0.x' + DOTNET_QUALITY: 'preview' + EnableNuGetPackageRestore: 'True' + +permissions: + contents: read + pull-requests: read + +jobs: + snippets-build: + runs-on: windows-2022 + + steps: + - name: Harden Runner + uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 + with: + egress-policy: audit + + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/pull/{0}/merge', inputs.pull_request) || github.ref }} + persist-credentials: false + + - name: Setup .NET + uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + dotnet-version: | + 10.0.x + ${{ env.DOTNET_VERSION }} + dotnet-quality: ${{ env.DOTNET_QUALITY }} + + - name: Display .NET info + run: dotnet --info + + - name: Clone docs-tools repository + run: git clone --depth 1 https://github.com/dotnet/docs-tools + + - name: Run snippets 5000 for PR + env: + GitHubKey: ${{ secrets.GITHUB_TOKEN }} + ExtensionsCodeTriggers: .cs;.vb;.fs;.xaml;.razor;.cshtml;.vbhtml;.sln;.slnx;.csproj;.fsproj;.vbproj;.proj + ExtensionsProjects: .sln;.slnx;.csproj;.fsproj;.vbproj;.proj + PR_NUMBER: ${{ github.event.pull_request.number || inputs.pull_request }} + REPOSITORY_OWNER: ${{ github.repository_owner }} + REPOSITORY_NAME: ${{ github.event.repository.name }} + run: | + dotnet run --project docs-tools\snippets5000\Snippets5000\Snippets5000.csproj -- --sourcepath "$env:GITHUB_WORKSPACE" --pullrequest "$env:PR_NUMBER" --owner "$env:REPOSITORY_OWNER" --repo "$env:REPOSITORY_NAME" diff --git a/.github/workflows/validate-samples.yml b/.github/workflows/validate-samples.yml deleted file mode 100644 index a8906b70..00000000 --- a/.github/workflows/validate-samples.yml +++ /dev/null @@ -1,115 +0,0 @@ -name: Validate samples - -on: - push: - branches: - - main - pull_request: - branches: - - main - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3 - id: filter - with: - filters: | - bwa100: - - '10.0/BlazorSample_BlazorWebApp/**' - bwa90: - - '9.0/BlazorSample_BlazorWebApp/**' - bwa80: - - '8.0/BlazorSample_BlazorWebApp/**' - bs70: - - '7.0/BlazorSample_Server/**' - bs60: - - '6.0/BlazorSample_Server/**' - bs50: - - '5.0/BlazorSample_Server/**' - bs31: - - '3.1/BlazorSample_Server/**' - bw100: - - '10.0/BlazorSample_WebAssembly/**' - bw90: - - '9.0/BlazorSample_WebAssembly/**' - bw80: - - '8.0/BlazorSample_WebAssembly/**' - bw70: - - '7.0/BlazorSample_WebAssembly/**' - bw60: - - '6.0/BlazorSample_WebAssembly/**' - bw50: - - '5.0/BlazorSample_WebAssembly/**' - bw31: - - '3.1/BlazorSample_WebAssembly/**' - - - name: Get latest .NET SDK - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 - with: - dotnet-version: 'latest' - dotnet-quality: 'ga' - - - name: Restore/build 10.0/BlazorSample_BlazorWebApp - if: steps.filter.outputs.bwa100 == 'true' - run: dotnet build 10.0/BlazorSample_BlazorWebApp - - - name: Restore/build 9.0/BlazorSample_BlazorWebApp - if: steps.filter.outputs.bwa90 == 'true' - run: dotnet build 9.0/BlazorSample_BlazorWebApp - - - name: Restore/build 8.0/BlazorSample_BlazorWebApp - if: steps.filter.outputs.bwa80 == 'true' - run: dotnet build 8.0/BlazorSample_BlazorWebApp - - - name: Restore/build 7.0/BlazorSample_Server - if: steps.filter.outputs.bs70 == 'true' - run: dotnet build 7.0/BlazorSample_Server - - - name: Restore/build 6.0/BlazorSample_Server - if: steps.filter.outputs.bs60 == 'true' - run: dotnet build 6.0/BlazorSample_Server - - - name: Restore/build 5.0/BlazorSample_Server - if: steps.filter.outputs.bs50 == 'true' - run: dotnet build 5.0/BlazorSample_Server - - - name: Restore/build 3.1/BlazorSample_Server - if: steps.filter.outputs.bs31 == 'true' - run: dotnet build 3.1/BlazorSample_Server - - - name: Restore/build 10.0/BlazorSample_WebAssembly - if: steps.filter.outputs.bw100 == 'true' - run: dotnet build 10.0/BlazorSample_WebAssembly - - - name: Restore/build 9.0/BlazorSample_WebAssembly - if: steps.filter.outputs.bw90 == 'true' - run: dotnet build 9.0/BlazorSample_WebAssembly - - - name: Restore/build 8.0/BlazorSample_WebAssembly - if: steps.filter.outputs.bw80 == 'true' - run: dotnet build 8.0/BlazorSample_WebAssembly - - - name: Restore/build 7.0/BlazorSample_WebAssembly - if: steps.filter.outputs.bw70 == 'true' - run: dotnet build 7.0/BlazorSample_WebAssembly - - - name: Restore/build 6.0/BlazorSample_WebAssembly - if: steps.filter.outputs.bw60 == 'true' - run: dotnet build 6.0/BlazorSample_WebAssembly - - - name: Restore/build 5.0/BlazorSample_WebAssembly - if: steps.filter.outputs.bw50 == 'true' - run: dotnet build 5.0/BlazorSample_WebAssembly - - - name: Restore/build 3.1/BlazorSample_WebAssembly - if: steps.filter.outputs.bw31 == 'true' - run: dotnet build 3.1/BlazorSample_WebAssembly diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..9f4dbc2c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,31 @@ +# Contribute to the ASP.NET Core documentation + +This document covers the process for contributing Blazor sample apps for the [ASP.NET documentation site](https://learn.microsoft.com/aspnet/). + +## How to make a simple correction or suggestion + +Simple changes are made in the browser by selecting the **Edit** link in the upper-right corner of the browser window. (In a narrow browser window, expand the **options** bar to see the **Edit** link.) Follow the directions to create a pull request (PR). We will review the PR and accept it or suggest changes. + +## How to make a more complex submission + +You need a basic understanding of [Git and GitHub.com](https://guides.github.com/activities/hello-world/). + +* Open an [issue](https://github.com/dotnet/blazor-samples/issues) describing what you want to do. Wait for approval from the team before you invest much time. +* Fork the [`dotnet/blazor-samples` GitHub repository](https://github.com/dotnet/blazor-samples) and create a branch for your changes. +* Submit a PR to the *main* branch with your changes. +* If your PR has the label 'cla-required' assigned, [complete the Contribution License Agreement (CLA)](https://cla.dotnetfoundation.org/). +* Respond to PR feedback. + +## Code compilation checks + +The **Snippets 5000** workflow runs for pull requests that target `main`. It uses [Snippets5000](https://github.com/dotnet/docs-tools/tree/main/snippets5000) to discover and compile sample projects and solutions affected by changes to code files, Razor files, project files, solution files, or build configuration files such as `global.json` and `snippets.5000.json`. + +Review compilation errors in the workflow logs and fix failures in the affected samples before merging. The workflow runs on Windows with the .NET 11 preview SDK and the .NET 10 SDK and runtime. + +To rerun the check manually, select **Actions** > **Snippets 5000** > **Run workflow** and enter the pull request number. The workflow checks out that pull request's merge ref and builds its affected samples. + +## Related content + +* [Contribute to the ASP.NET Core documentation](https://github.com/dotnet/AspNetCore.Docs/blob/main/CONTRIBUTING.md) +* [Funamentals: Razor components](https://learn.microsoft.com/aspnet/core/blazor/fundamentals/#razor-components) +* [ASP.NET Core Razor components: Razor syntax](https://learn.microsoft.com/aspnet/core/blazor/components/#razor-syntax)