-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJustfile
More file actions
146 lines (120 loc) · 5.5 KB
/
Copy pathJustfile
File metadata and controls
146 lines (120 loc) · 5.5 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
set quiet
root_folder := "./src/"
solution_file := root_folder + "ValueObjects.slnx"
test_solution := solution_file
build_configuration := "Debug"
pipeline_feed := "https://api.nuget.org/v3/index.json"
pipeline_tool := ".tools/purview-build/purview-build"
artifact_folder := "./artifacts/"
# Displays the list of available commands
[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, pack, validate)
[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
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
# -----------------------------------------------------------------------------
# Builds the solution with the specified configuration (default: Debug)
[group('Build and Test')]
build *args:
echo "Building {{ BLUE }}{{ solution_file }}{{ NORMAL }} with {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}..."
dotnet build "{{ solution_file }}" --configuration "{{ build_configuration }}" {{ args }}
# Restore NuGet packages for the solution
[group('Build and Test')]
restore *args:
dotnet restore {{ solution_file }} {{ args }}
# Runs tests for the solution with the specified configuration (default: Debug)
[group('Build and Test')]
test filter="/*/*/*/*/" *args:
echo "Running tests for {{ BLUE }}{{ test_solution }}{{ NORMAL }} with {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}..."
dotnet test --solution "{{ test_solution }}" --configuration "{{ build_configuration }}" --treenode-filter={{ filter }} {{ args }}
# Cleans the solution with the specified configuration (default: Debug)
[group('Build and Test')]
clean *args:
echo "Cleaning {{ BLUE }}{{ solution_file }}{{ NORMAL }} with {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}..."
dotnet clean "{{ solution_file }}" --configuration "{{ build_configuration }}" {{ args }}
# Packs the package into a NuGet package and outputs it to the specified folder
[group('Build and Test')]
pack *args:
just build
echo "Packing {{ BLUE }}{{ solution_file }}{{ NORMAL }} with {{ YELLOW }}{{ build_configuration }}{{ NORMAL }}..."
dotnet pack "{{ solution_file }}" --configuration "{{ build_configuration }}" --no-restore --output "{{ artifact_folder }}" {{ args }}
# -----------------------------------------------------------------------------
# Formatting
# -----------------------------------------------------------------------------
# Checks for linting issues in the root folder
[group('Formatting')]
lint-check:
echo "Linting checking {{ BLUE }}root folder{{ NORMAL }}..."
dotnet csharpier check .
# Fixes linting issues in the root folder
[group('Formatting')]
lint-fix:
echo "Linting fixing {{ BLUE }}root folder{{ NORMAL }}..."
dotnet csharpier format .
# -----------------------------------------------------------------------------
# Versioning and Release
# -----------------------------------------------------------------------------
# Displays the current version of the project.
# Requires Bun.
[group('Versioning and Release')]
version:
bun -e "console.log('Current Version: {{ GREEN }}' + require('./package.json').version + '{{ NORMAL }}')"
# -----------------------------------------------------------------------------
# System / Shell
# -----------------------------------------------------------------------------
# Opens the solution in the default associated application
[group('Utilities')]
vs:
echo "Opening {{ BLUE }}{{ solution_file }}{{ NORMAL }}..."
open "{{ solution_file }}"
# Opens the root folder in Visual Studio Code
[group('Utilities')]
code:
echo "Opening {{ BLUE }}Visual Studio Code{{ NORMAL }}..."
code "{{ root_folder }}"
# 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