diff --git a/README.md b/README.md index 6b31024..48c2bd4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # dotnet-proj-diff -![NuGet Version](https://img.shields.io/nuget/v/ProjectDiff.Tool) +[![NuGet Version](https://img.shields.io/nuget/v/dotnet-proj-diff)](https://www.nuget.org/packages/dotnet-proj-diff) ![GitHub License](https://img.shields.io/github/license/dotTrench/dotnet-proj-diff) [Documentation](docs/) diff --git a/docs/github.md b/docs/github.md index 8a6acb9..2c8085c 100644 --- a/docs/github.md +++ b/docs/github.md @@ -1,6 +1,10 @@ # Github Actions +## Sample GitHub Actions Workflows -## Test Pull Request +### Test Pull Request + +This creates a workflow that runs on pull requests to the `main` and `dev` branches. It uses `dotnet-proj-diff` to determine which projects have changed, restores, builds, and tests only those projects. +dotnet-proj-diff generates a solution filter file (`.slnf`) that contains only the projects that have changed, which is then used for restoring, building, and testing. ```yaml name: "Test Pull Request" @@ -27,19 +31,23 @@ jobs: run: dotnet tool install --global dotnet-proj-diff - name: Run dotnet-proj-diff - run: dotnet-proj-diff ${{ github.target_ref }} --output /tmp/diff.slnf + run: dotnet-proj-diff --base ${{ github.target_ref }} --output /tmp/diff.slnf - - name: Restore solution + - name: Restore changed projects run: dotnet restore /tmp/diff.slnf - - name: Build solution - run: dotnet build /tmp/diff.slnf --configuration Release + - name: Build changed projects + run: dotnet build /tmp/diff.slnf --configuration Release --no-restore - - name: Run tests - run: dotnet test /tmp/diff.slnf --configuration Release --no-build --verbosity normal + - name: Test changed projects + run: dotnet test /tmp/diff.slnf --configuration Release --no-build --no-restore ``` ### Publish projects on main branch + +This workflow runs on pushes to the `main` branch. It uses `dotnet-proj-diff` to determine which projects have changed, restores, builds, and publishes those projects. +dotnet-proj-diff generates a solution filter file (`.slnf`) that contains only the projects that have changed, which is then used for restoring, building, and publishing. + ```yaml name: "Publish Projects" on: @@ -68,16 +76,16 @@ jobs: uses: nrwl/nx-set-shas@v4 - name: Run dotnet-proj-diff - run: dotnet-proj-diff --base ${{ env.NX_BASE }} --output /tmp/diff.slnf + run: dotnet-proj-diff --base ${{ env.NX_BASE }} --output /tmp/diff.slnf - - name: Restore solution + - name: Restore changed projects run: dotnet restore /tmp/diff.slnf - - name: Build solution - run: dotnet build /tmp/diff.slnf --configuration Release + - name: Build changed projects + run: dotnet build /tmp/diff.slnf --configuration Release --no-restore # Maybe you want to publish the projects as container images to be cool and hip - - name: Publish projects - run: dotnet publish /tmp/diff.slnf /t:PublishContainer + - name: Publish changed projects + run: dotnet publish /tmp/diff.slnf /t:PublishContainer --no-build --no-restore --configuration Release ``` diff --git a/pack-and-install.sh b/pack-and-install.sh index c84e9fd..1923343 100644 --- a/pack-and-install.sh +++ b/pack-and-install.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash -set -e +set -euo pipefail dotnet pack dotnet tool uninstall --global dotnet-proj-diff diff --git a/src/ProjectDiff.Core/ProjectGraphFactory.cs b/src/ProjectDiff.Core/ProjectGraphFactory.cs index 90747ef..1b019d0 100644 --- a/src/ProjectDiff.Core/ProjectGraphFactory.cs +++ b/src/ProjectDiff.Core/ProjectGraphFactory.cs @@ -1,4 +1,4 @@ -using LibGit2Sharp; +using LibGit2Sharp; using Microsoft.Build.Definition; using Microsoft.Build.Evaluation; using Microsoft.Build.Evaluation.Context; diff --git a/src/ProjectDiff.Core/README.md b/src/ProjectDiff.Core/README.md index 1250de7..268221f 100644 --- a/src/ProjectDiff.Core/README.md +++ b/src/ProjectDiff.Core/README.md @@ -1,3 +1,9 @@ # ProjectDiff.Core -Contains core classes for ProjectDiff. Might be useful if you want to build custom Nuke/Cake tasks \ No newline at end of file +[![NuGet Version](https://img.shields.io/nuget/v/ProjectDiff.Core)](https://www.nuget.org/packages/ProjectDiff.Core) +![GitHub License](https://img.shields.io/github/license/dotTrench/dotnet-proj-diff) + +This project contains the core classes for `dotnet-proj-diff`. It is primarily used by the CLI tool, but can also be +used in other projects. +This project might be useful if you want to build custom Nuke/Cake tasks or integrate the project diff functionality +into your own applications.