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
73 changes: 13 additions & 60 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,76 +8,29 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
DOTNET_NOLOGO: true

jobs:
build:
name: Build, lint & package
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
~/.local/share/NuGet
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props', '**/*.csproj', '**/*.props', '**/*.targets', 'global.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Run PR pipeline (without tests)
env:
Build__RunTests: "false"
run: dotnet run --project build/PipelineCLI/PipelineCLI.csproj --configuration Release
uses: purview-dev/build/.github/workflows/purview-build.yml@main
with:
build-version: "0.2.1"
run-tests: false
secrets: inherit

tests:
name: Tests (${{ matrix.project }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
project:
- Analyzers.UnitTests.csproj
- Analyzers.IntegrationTests.csproj
- DotNetProjectSdk.IntegrationTests.csproj
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
~/.local/share/NuGet
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props', '**/*.csproj', '**/*.props', '**/*.targets', 'global.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Run tests for ${{ matrix.project }}
env:
Build__RunTests: "true"
Build__TestProjects: ${{ matrix.project }}
Build__RunLint: "false"
Build__RunPack: "false"
run: dotnet run --project build/PipelineCLI/PipelineCLI.csproj --configuration Release
uses: purview-dev/build/.github/workflows/purview-build.yml@main
with:
build-version: "0.2.1"
run-lint: false
run-pack: false
validate-pack: false
test-projects: ${{ matrix.project }}
secrets: inherit
54 changes: 6 additions & 48 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,9 @@ concurrency:
jobs:
release:
name: Release packages
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true

- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: "10.0.x"

- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: |
~/.nuget/packages
~/.local/share/NuGet
key: ${{ runner.os }}-nuget-${{ hashFiles('**/Directory.Packages.props', '**/*.csproj', '**/*.props', '**/*.targets', 'global.json') }}
restore-keys: |
${{ runner.os }}-nuget-

- name: Check for version bump
id: version
shell: bash
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="v$VERSION"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Version $VERSION is already tagged as $TAG. Skipping release."
echo "should_publish=false" >> "$GITHUB_OUTPUT"
else
echo "New version $VERSION detected. Releasing $TAG."
echo "should_publish=true" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
fi

- name: Run release pipeline
if: steps.version.outputs.should_publish == 'true'
env:
Release__Mode: NuGet
GITHUB_TOKEN: ${{ github.token }}
NuGet__ApiKey: ${{ secrets.NUGET__APIKEY }}
run: dotnet run --project build/PipelineCLI/PipelineCLI.csproj --configuration Release
uses: purview-dev/build/.github/workflows/purview-release.yml@main
with:
build-version: "0.2.1"
release-mode: NuGet
release-branch: main
secrets: inherit
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -661,3 +661,5 @@ sketch

!build/


.tools/
34 changes: 21 additions & 13 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,66 @@ solution_file := "src/DotNetProjectSdk.slnx"
build_configuration := "Release"
artifacts_folder := "./artifacts"

pipeline_solution := "build/Pipeline.slnx"
pipeline_project := "build/PipelineCLI/PipelineCLI.csproj"
pipeline_version := "0.2.1"
pipeline_feed := "https://api.nuget.org/v3/index.json"
pipeline_tool := ".tools/purview-build/purview-build"

current_version := `node -p "require('./package.json').version"`

[private]
default:
just --list

# Install the shared Purview.Build tool (authenticated to the Purview-Dev feed) if not present
[private]
ensure-pipeline-tool:
if [ ! -x "{{ pipeline_tool }}" ]; then \
dotnet tool install Purview.Build --tool-path .tools/purview-build --add-source "{{ pipeline_feed }}" --version "{{ pipeline_version }}"; \
fi

# Run the PR pipeline (restore, build, lint, tests)
[group('Pipeline')]
pipeline-pr *args:
just ensure-pipeline-tool
echo "Running PR pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} {{ args }}
"{{ pipeline_tool }}" {{ args }}

# Run the build pipeline (restore, build, lint)
[group('Pipeline')]
pipeline-build *args:
just ensure-pipeline-tool
echo "Running build pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Build:RunTests=false --Release:Mode=None {{ args }}
"{{ pipeline_tool }}" --Build:RunTests=false --Release:Mode=None {{ args }}

# Run the release pipeline (restore, build, lint, tests, pack, publish, GitHub release)
[group('Pipeline')]
pipeline-release *args:
just ensure-pipeline-tool
echo "Running release pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Release:Mode=NuGet {{ args }}
"{{ pipeline_tool }}" --Release:Mode=NuGet {{ args }}

# Run the release pipeline (restore, build, lint, tests, pack, local nuget publish)
# Note: `just` runs recipes through the shell, which strips backslashes from unquoted arguments.
# Always use forward slashes for the feed path, e.g.
# Use the LOCAL_NUGET_FEED_PATH environment variable or forward slashes, e.g.
# just pipeline-local-release --PublishLocalNuGet:LocalFeedPath=p:/_sync-projects/.local-nuget/
[group('Pipeline')]
pipeline-local-release *args:
just ensure-pipeline-tool
echo "Running local release pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Release:Mode=LocalNuGet {{ args }}
"{{ pipeline_tool }}" --Release:Mode=LocalNuGet {{ args }}

# Run the pipeline with tests enabled
[group('Pipeline')]
pipeline-tests *args:
just ensure-pipeline-tool
echo "Running tests pipeline..."
dotnet run --project {{ pipeline_project }} --configuration {{ build_configuration }} -- --Build:RunTests=true --Release:Mode=None {{ args }}
"{{ pipeline_tool }}" --Build:RunTests=true --Release:Mode=None {{ args }}

# Open the solution in Visual Studio/ Registered application
[group('Utilities')]
vs:
open {{ solution_file }}

# Open the solution in Visual Studio/ Registered application
[group('Utilities')]
vs-pipeline:
open {{ pipeline_solution }}

# Build the solution for the specified configuration (default: Release)
[group('Build and Test')]
build *args:
Expand Down
12 changes: 0 additions & 12 deletions build/Directory.Build.props

This file was deleted.

3 changes: 0 additions & 3 deletions build/Directory.Build.targets

This file was deleted.

15 changes: 0 additions & 15 deletions build/Directory.Packages.props

This file was deleted.

11 changes: 0 additions & 11 deletions build/Pipeline.slnx

This file was deleted.

11 changes: 0 additions & 11 deletions build/PipelineCLI/GlobalUsings.cs

This file was deleted.

9 changes: 0 additions & 9 deletions build/PipelineCLI/Helpers/DotNetCLIOptions.cs

This file was deleted.

21 changes: 0 additions & 21 deletions build/PipelineCLI/Helpers/PathHelpers.cs

This file was deleted.

39 changes: 0 additions & 39 deletions build/PipelineCLI/Helpers/TestHelpers.cs

This file was deleted.

30 changes: 0 additions & 30 deletions build/PipelineCLI/Modules/BuildModule.cs

This file was deleted.

Loading