Build Stride NDepend Analysis for GitHub Pages #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # More GitHub Actions for Azure: https://github.com/Azure/actions | |
| name: Build Stride NDepend Analysis for GitHub Pages | |
| env: | |
| PROJECT_PATH_CORE: build/Stride.sln | |
| on: | |
| workflow_dispatch: | |
| # Only allow one deployment at a time, cancel previous in-progress runs on new pushes | |
| concurrency: | |
| group: pages-stride | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write # to push to gh-pages branch | |
| jobs: | |
| build-and-deploy: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Dotnet Setup | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.x | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Checkout Stride (note the LFS) | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: stride3d/stride | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| lfs: true | |
| path: source | |
| - name: Checkout gh-pages branch | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: gh-pages | |
| path: gh-pages | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create .sarif Folder | |
| working-directory: source | |
| run: | | |
| mkdir build\.sarif | |
| - name: Create Directory.Build.props | |
| working-directory: source | |
| shell: powershell | |
| run: | | |
| Add-Content -Path Directory.Build.props -Value '<Project>' | |
| Add-Content -Path Directory.Build.props -Value ' <PropertyGroup>' | |
| Add-Content -Path Directory.Build.props -Value ' <ErrorLog>$(SolutionDir)\.sarif\$(MSBuildProjectName).json</ErrorLog>' | |
| Add-Content -Path Directory.Build.props -Value ' </PropertyGroup>' | |
| Add-Content -Path Directory.Build.props -Value '</Project>' | |
| - name: Build Stride.sln | |
| working-directory: source | |
| # run: msbuild build/Stride.build -t:Build | |
| run: dotnet build "build/Stride.sln" | |
| - name: NDepend | |
| uses: ndepend/ndepend-action@v2 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| license: ${{ secrets.NDependLicense }} | |
| solution: source/${{ env.PROJECT_PATH_CORE }} | |
| baseline: recent | |
| - name: Copy NDepend results to gh-pages | |
| shell: pwsh | |
| run: | | |
| $dest = "gh-pages/stride/ndepend" | |
| New-Item -ItemType Directory -Force -Path $dest | Out-Null | |
| Copy-Item -Path ..\..\_temp\NDependOut\NDependReport.html -Destination "$dest\NDependReport.html" -Force | |
| Copy-Item -Path ..\..\_temp\NDependOut\NDependReportFiles -Destination "$dest\" -Recurse -Force | |
| - name: Commit and push to gh-pages | |
| working-directory: gh-pages | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git diff --staged --quiet || git commit -m "Update Stride NDepend report" | |
| git push |