Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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/)
Expand Down
34 changes: 21 additions & 13 deletions docs/github.md
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -27,19 +31,23 @@ jobs:
run: dotnet tool install --global dotnet-proj-diff

- name: Run dotnet-proj-diff
run: dotnet-proj-diff <YOUR_SOLUTION_FILE> ${{ 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:
Expand Down Expand Up @@ -68,16 +76,16 @@ jobs:
uses: nrwl/nx-set-shas@v4

- name: Run dotnet-proj-diff
run: dotnet-proj-diff <YOUR_SOLUTION_FILE> --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
```

4 changes: 2 additions & 2 deletions pack-and-install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/usr/bin/env bash

set -e
set -euo pipefail

dotnet pack
dotnet tool uninstall --global dotnet-proj-diff
Expand Down
2 changes: 1 addition & 1 deletion src/ProjectDiff.Core/ProjectGraphFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using LibGit2Sharp;
using LibGit2Sharp;
using Microsoft.Build.Definition;
using Microsoft.Build.Evaluation;
using Microsoft.Build.Evaluation.Context;
Expand Down
8 changes: 7 additions & 1 deletion src/ProjectDiff.Core/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# ProjectDiff.Core

Contains core classes for ProjectDiff. Might be useful if you want to build custom Nuke/Cake tasks
[![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.
Loading