-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
126 lines (104 loc) · 5.03 KB
/
Copy pathJustfile
File metadata and controls
126 lines (104 loc) · 5.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
set quiet
solution_file := "src/BuildSdk.slnx"
build_configuration := "Debug"
artifacts_folder := "./artifacts"
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 }}"; \
fi
# Run the PR pipeline (restore, build, lint, tests)
[group('Pipeline')]
pipeline-pr *args:
just ensure-pipeline-tool
echo "Running PR pipeline..."
"{{ pipeline_tool }}" {{ args }}
# Run the build pipeline (restore, build, lint)
[group('Pipeline')]
pipeline-build *args:
just ensure-pipeline-tool
echo "Running build pipeline..."
"{{ 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..."
"{{ 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.
# 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
just lint-fix
echo "Running local release pipeline..."
"{{ 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..."
"{{ pipeline_tool }}" --Build:RunTests=true --Release:Mode=None {{ args }}
# Run the pipeline through pack + validate (restore, build, lint, tests, pack, validate pack contents) without publishing/releasing
[group('Pipeline')]
pipeline-pack-validate *args:
just ensure-pipeline-tool
echo "Running pack + validate pipeline..."
"{{ pipeline_tool }}" --Build:RunPack=true --Build:ValidatePack=true --Release:Mode=None {{ args }}
# Open the solution in Visual Studio/ Registered application
[group('Utilities')]
vs:
open {{ solution_file }}
# Build the solution for the specified configuration (default: Release)
[group('Build and Test')]
build *args:
echo "==> Building {{ BLUE }}{{ solution_file }}{{ NORMAL }} ({{ GREEN }}{{ current_version }}{{ NORMAL }}) with configuration {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}"
dotnet build {{ solution_file }} --configuration {{ build_configuration }} {{ args }}
# Cleans the solution for the specified configuration (default: Release)
[group('Build and Test')]
clean *args:
echo "==> Cleaning {{ BLUE }}{{ solution_file }}{{ NORMAL }} ({{ GREEN }}{{ current_version }}{{ NORMAL }}) with configuration {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}"
dotnet clean {{ solution_file }} --configuration {{ build_configuration }} {{ args }}
# Restore local .NET tools
[group('Utilities')]
restore-tools:
dotnet tool restore
# Restore NuGet packages for the solution
[group('Build and Test')]
restore *args:
dotnet restore {{ solution_file }} {{ args }}
# Displays the current package version from package.json
[group('Build and Test')]
current_version:
echo "==> Current version: {{ GREEN }}{{ current_version }}{{ NORMAL }} (defined in package.json and automatically included in the build output through the Purview.BuildSdk package)"
# Run tests for a specific project with a filter (e.g., "/*/*/*/*/", or "/*/*/*/*[Category=Unit]" to run just unit tests) and configuration (e.g., "Release")
[group('Build and Test')]
test filter="/*/*/*/*/" *args:
echo "==> Testing {{ BLUE }}{{ solution_file }}{{ NORMAL }} ({{ GREEN }}{{ build_configuration }}{{ NORMAL }}) with filter {{ YELLOW }}{{ filter }}{{ NORMAL }}"
dotnet test --project {{ solution_file }} --configuration {{ build_configuration }} --treenode-filter "{{ filter }}" --ignore-exit-code 8 {{ args }}
# Run agent-pack integration tests in the same Linux SDK environment used by CI
[group('Build and Test')]
test-linux:
pwsh -NoProfile -File ./scripts/test-linux-docker.ps1
# Pack all packable projects
[group('Build and Test')]
pack artifact_folder=artifacts_folder *args:
echo "==> Packing {{ BLUE }}{{ solution_file }}{{ NORMAL }} ({{ GREEN }}{{ current_version }}{{ NORMAL }}) to {{ YELLOW }}{{ artifact_folder }}{{ NORMAL }}"
dotnet pack "{{ solution_file }}" --configuration "{{ build_configuration }}" --output "{{ artifact_folder }}" {{ args }}
# Format the code with CSharpier
[group('Utilities')]
lint-fix:
dotnet csharpier format .
# Check formatting with CSharpier
[group('Utilities')]
lint-check:
dotnet csharpier check .