Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
143 lines (121 loc) · 5.65 KB
/
Copy pathJustfile
File metadata and controls
143 lines (121 loc) · 5.65 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
set quiet
root_folder := "src"
solution := root_folder / "ZodSharp.slnx"
perf_tests_project := root_folder / "src" / "Benchmarks" / "Benchmarks.csproj"
build_configuration := "Debug"
artifacts_folder := "./artifacts"
default_test_filter := "/*/*/*/*"
pipeline_tool := "dotnet purview-build"
[private]
default:
just --list
# Restore the repository's .NET local tools (.config/dotnet-tools.json)
[private]
ensure-pipeline-tool:
dotnet tool restore
# 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 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 }}
# Build and run a throwaway consumer against the packed generator.
#
# The in-repo generator tests run against the unmerged generator, and pack validation only checks the
# IL-merged assembly is present in the .nupkg - not that it loads and generates. That merge has regressed
# twice (#36, #38), both times silently breaking consumers while this repository's tests stayed green.
[group('Pipeline')]
smoke-packed-generator *args:
echo "Running the packed generator smoke test..."
pwsh -NoProfile -File scripts/test-packed-generator.ps1 {{ 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 }}
# 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 }}
# Clean the solution 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 the performance benchmarks with the specified configuration, defaulting to "Debug"
[group('Build and Test')]
perf-tests *args:
echo "Running performance tests for {{ BLUE }}{{ perf_tests_project }}{{ NORMAL }}"
# Benchmarks multi-target net10.0/net11.0; default to net10.0. Pass `-f net11.0` to run on .NET 11.
dotnet run --project {{ perf_tests_project }} -c Release -f net10.0 {{ 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 }}
# 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 }}"
dotnet pack {{ solution }} -c {{ build_configuration }} -o {{ publish_folder }} {{ args }}
# Displays the current version of the project.
# Requires Bun.
[group('Build and Test')]
version:
bun -e "console.log('Current Version: {{ GREEN }}' + require('./package.json').version + '{{ NORMAL }}')"
# Check code formatting using CSharpier
[group('Utilities')]
lint-check:
dotnet csharpier check .
# dotnet format --verify-no-changes {{ solution }}
# Fix code formatting issues using CSharpier
[group('Utilities')]
lint-fix:
dotnet csharpier format .
# dotnet format {{ solution }}
# Open the solution in Visual Studio/ Registered application
[group('Utilities')]
vs:
open {{ solution }}
# 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