Develop #104
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
| name: CI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - 'assets/**' | |
| pull_request: | |
| branches: [ main, master ] | |
| paths-ignore: | |
| - '**.md' | |
| - 'docs/**' | |
| - 'assets/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ── Build & Test ───────────────────────────────────────────────────────────── | |
| build: | |
| name: Build & Test (.NET ${{ matrix.dotnet }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| dotnet: [ '10.0.x' ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET ${{ matrix.dotnet }} | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ matrix.dotnet }} | |
| - name: Release hygiene guard | |
| shell: pwsh | |
| run: ./tools/check-release-hygiene.ps1 | |
| - name: Restore | |
| run: dotnet restore PawSharp.sln | |
| - name: Build | |
| run: dotnet build PawSharp.sln -c Release --no-restore --nologo | |
| - name: Test | |
| run: | | |
| dotnet test PawSharp.sln -c Release --no-build --nologo \ | |
| --logger "trx;LogFileName=results.trx" \ | |
| --results-directory ./test-results | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-${{ matrix.dotnet }} | |
| path: test-results/ | |
| # ── Pack preview (on main only) ─────────────────────────────────────────────── | |
| pack-preview: | |
| name: Pack NuGet Preview | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Restore | |
| run: dotnet restore PawSharp.sln | |
| - name: Build | |
| run: dotnet build PawSharp.sln -c Release --no-restore --nologo | |
| - name: Pack all library projects | |
| run: | | |
| rm -rf ./nupkgs | |
| mkdir -p ./nupkgs | |
| for project in src/*/*.csproj; do | |
| dotnet pack "$project" -c Release --no-build --nologo --output ./nupkgs | |
| done | |
| - name: Upload packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nupkgs-preview-${{ github.run_number }} | |
| path: nupkgs/*.nupkg | |
| retention-days: 14 | |
| # ── Documentation (on main only) ───────────────────────────────────────────── | |
| docs: | |
| name: Build & Deploy Documentation | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Restore & Build for DocFX | |
| run: | | |
| dotnet restore PawSharp.sln | |
| dotnet build PawSharp.sln -c Release --no-restore --nologo | |
| - name: Install DocFX | |
| run: dotnet tool restore | |
| - name: Generate Documentation | |
| run: | | |
| dotnet docfx metadata | |
| dotnet docfx build | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./_site | |
| commit_message: "docs: auto-publish from ${{ github.sha }}" |