Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
176 lines (146 loc) · 7.34 KB
/
Copy pathJustfile
File metadata and controls
176 lines (146 loc) · 7.34 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
set quiet
export TESTINGPLATFORM_EXITCODE_IGNORE := "8"
export DOTNET_CLI_TELEMETRY_OPTOUT := "1"
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE := "1"
export DO_NOT_TRACK := "1"
solution := "src/Results.slnx"
build_configuration := "Debug"
artifacts_folder := "./artifacts"
default_test_filter := "/*/*/*/*"
pipeline_tool := "dotnet purview-build"
current_version := `bun -p "require('./package.json').version"`
[private]
default:
just --list
# Restore the repository's .NET local tools (.config/dotnet-tools.json)
[private]
ensure-pipeline-tool:
pwsh -NoProfile -File scripts/restore-dotnet-tools.ps1
# 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
just lint-fix
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 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 }}
# Displays the current version from package.json
[group('Build and Test')]
version:
echo "Current version is {{ BLUE }}{{ current_version }}{{ NORMAL }}"
# Build and test with the specified configuration, defaulting to "Debug"
[group('Build and Test')]
build *args:
echo "Building {{ BLUE }}{{ solution }}{{ NORMAL }} with configuration {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}"
dotnet build {{ solution }} -c {{ build_configuration }} {{ args }}
# Build and test with the specified configuration, defaulting to "Debug"
[group('Build and Test')]
clean *args:
echo "Cleaning {{ BLUE }}{{ solution }}{{ NORMAL }} with configuration {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}"
dotnet clean {{ solution }} -c {{ build_configuration }} {{ args }}
# Run tests with the specified configuration, defaulting to "Debug"
[group('Build and Test')]
test filter=default_test_filter *args:
echo "Running tests for {{ BLUE }}{{ solution }}{{ NORMAL }} with configuration {{ YELLOW }}{{ build_configuration }}{{ NORMAL }} and filter {{ GREEN }}{{ filter }}{{ NORMAL }}"
dotnet test {{ solution }} -c {{ build_configuration }} --treenode-filter "{{ filter }}" -- {{ args }}
# Run the unit tests
[group('Build and Test')]
test-unit *args:
just test "/*/*/*/*[Category=Unit]" {{ args }}
# Restore dependencies for the solution
[group('Build and Test')]
restore *args:
echo "Restoring dependencies for {{ BLUE }}{{ solution }}{{ NORMAL }}"
dotnet restore {{ solution }} {{ args }}
# Create NuGet package for the project
[group('Build and Test')]
pack publish_folder=artifacts_folder *args:
echo "Packing {{ BLUE }}{{ solution }}{{ NORMAL }} with configuration {{ YELLOW }}{{ build_configuration }}{{ NORMAL }} to {{ GREEN }}{{ publish_folder }}{{ NORMAL }}"
echo " Current version is {{ BLUE }}{{ current_version }}{{ NORMAL }}"
dotnet pack {{ solution }} -c {{ build_configuration }} -o {{ publish_folder }} {{ args }}
# Prove the packed packages work for real consumers: packs every Purview.Results package to an isolated feed, then
# publishes and runs a Native AOT console, a Blazor WebAssembly app (trimmed and RunAOTCompilation, run in a headless
# browser), a Blazor Server app (minimal API, static form and interactive page) and a net10.0 console against them,
# and leak-scans every output for compiler-host assemblies. Needs the Native AOT toolchain, the wasm-tools workload for
# the WebAssembly AOT step, and Chrome or Edge for the browser steps. Dependency versions not yet on nuget.org
# (Purview.ZodSharp, Purview.ValueObjects, Purview.SourceGeneratorFramework) restore from LOCAL_NUGET_FEED_PATH (or
# RESULTS_DEPENDENCY_FEED). See scripts/test-packed-consumers.ps1 for the options.
[group('Build and Test')]
smoke-packed-consumers *args:
echo "Running the packed consumer gate..."
pwsh -NoProfile -File scripts/test-packed-consumers.ps1 {{ args }}
# Prove every PackValidation ForbiddenContent rule in .config/purview-build.json rejects a package. Reads artifacts/, so
# pack first (`just pipeline-pack-validate`); `just pipeline-local-release` moves its packages to the local feed, so pass
# -PackagesFolder <feed> after it.
[group('Build and Test')]
verify-pack-rules *args:
just ensure-pipeline-tool
pwsh -NoProfile -File scripts/test-pack-validation-rules.ps1 {{ args }}
# Run the Basic example (result states, combinators and the generated AsFailure helpers)
[group('Examples')]
example-basic *args:
dotnet run --project src/src/Examples.Basic {{ args }}
# Run the ZodSharp example (a validation outcome flowing through the result pipeline)
[group('Examples')]
example-zod *args:
dotnet run --project src/src/Examples.Zod {{ args }}
# Run the ASP.NET Core example (result-to-response mapping), listening on http://localhost:5215
[group('Examples')]
example-aspnetcore *args:
dotnet run --project src/src/Examples.AspNetCore --urls http://localhost:5215 {{ args }}
# Run the ASP.NET Core + ZodSharp example (validation problems from result failures), listening on http://localhost:5216
[group('Examples')]
example-aspnetcore-zod *args:
dotnet run --project src/src/Examples.AspNetCore.Zod --urls http://localhost:5216 {{ args }}
# Run the ValueObjects + ZodSharp example (a type-level [ZodRule] flowing into the result and HTTP mapping)
[group('Examples')]
example-valueobjects-zod *args:
dotnet run --project src/src/Examples.ValueObjects.Zod {{ args }}
# Open the solution in Visual Studio/ Registered application
[group('Utilities')]
vs:
open {{ solution }}
# Fix code formatting issues using CSharpier (and remove GUID Id attributes from .slnx files first)
[group('Utilities')]
lint-fix *args:
bun run lint:slnx:fix
dotnet csharpier format . {{ args }}
# Check code formatting using CSharpier (and validate .slnx files have no GUID Id attributes)
[group('Utilities')]
lint-check *args:
bun run lint:slnx:check
dotnet csharpier check . {{ args }}
# Clean up the repository by removing build artifacts, bin/obj folders etc, and shutting down the build server
[group('Utilities')]
scrub:
find . -type d \( -name bin -o -name obj \) -exec rm -rf {} +
just clean
just restore --force-evaluate
dotnet build-server shutdown