-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.Taskfile.yaml
More file actions
178 lines (153 loc) · 6.24 KB
/
Module.Taskfile.yaml
File metadata and controls
178 lines (153 loc) · 6.24 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
177
178
# https://taskfile.dev
#Called by the vnbuild system to produce builds for my website
#https://www.vaughnnugent.com/resources/software
#This taskfile performs the build operations for a module, it handles
#git code updates, msbuild on solutions, and sleet NuGet feed pushes.
#this file must be in the same directory as the solution file
version: '3'
vars:
ARCHIVE_FILE_NAME: '{{ .ARCHIVE_FILE_NAME | default "archive.tgz" }}'
tasks:
default:
desc: 'Builds the managed libraries in this module for development'
cmds:
- cmd: dotnet build -c debug {{ .CLI_ARGS }}
#called by build pipeline to sync repo
update:
cmds:
- cmd: git reset --hard #clean up any local changes
- cmd: git remote update
- cmd: git pull origin {{ .BRANCH_NAME }} --verify-signatures
tag-current-commit:
desc: 'Tags the current commit with the current build version from gitversion'
vars:
#get the current build version from gitversion
BUILD_VERSION:
sh: dotnet gitversion /showvariable FullSemver
#ensure the current branch is master
status:
#see if tag already exists otherwise error on windows
- git tag --list v{{ .BUILD_VERSION }} | findstr . >nul
cmds:
- cmd: echo "Tagging current commit with version v{{ .BUILD_VERSION }}"
- cmd: git tag -s -a v{{ .BUILD_VERSION }} -m "CI Build version {{ .BUILD_VERSION }}"
- cmd: git push origin v{{ .BUILD_VERSION }}
#called by build pipeline to build module
build:
desc: "Used by vnbuild to build the entire module at CI time"
vars:
PACK_OUT: '{{ .OUTPUT_DIR }}/{{ .HEAD_SHA }}/pkg'
INT_DIR: '{{ .SCRATCH_DIR }}/obj/{{ .MODULE_NAME }}/'
MS_ARGS: '
--nologo
/p:UseCommonOutputDirectory=true
/p:IntermediateOutputPath="{{ .INT_DIR }}"'
cmds:
- cmd: echo "building module {{ .MODULE_NAME }}"
silent: true
#re-write semver after hard reset
- cmd: dotnet gitversion /updateprojectfiles
#build debug mode first
- cmd: dotnet publish -c debug {{ .MS_ARGS }}
- cmd: dotnet publish -c release {{ .MS_ARGS }}
# ONLY Pack release config with debug symbols
# pack can be run without build or restore because the previous commands build it
- cmd: dotnet pack
--no-build
--no-restore
--include-symbols
--configuration release
--output "{{ .PACK_OUT }}/release/"
{{ .MS_ARGS }}
publish:
desc: "Used by vnbuild to prepare the packages for build servers"
cmds:
#git archive in the module directory
- cmd: git archive --format {{ .ARCHIVE_FILE_FORMAT }} --output {{ .ARCHIVE_FILE_NAME }} HEAD
test:
desc: "Runs managed tests against the entire solution and all loaded test projects"
vars:
NATIVE_BUILD_PATH: 'build/{{ OS }}/{{ if eq OS "windows"}}Debug/{{end}}'
LIB_PREFIX: '{{ if eq OS "windows"}}vnlib{{else}}libvn{{end}}'
#these are native library paths produced when the child modules are built
RPMALLOC_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Memory/vnlib_rpmalloc/{{ .NATIVE_BUILD_PATH }}{{ .LIB_PREFIX }}_rpmalloc'
MIMALLOC_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Memory/vnlib_mimalloc/{{ .NATIVE_BUILD_PATH}}{{ .LIB_PREFIX }}_mimalloc'
VNCOMPRESS_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Net.Compression/vnlib_compress/{{ .NATIVE_BUILD_PATH }}{{ .LIB_PREFIX }}_compress'
MONOCYPHER_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Cryptography/monocypher/{{ .NATIVE_BUILD_PATH }}{{ .LIB_PREFIX }}_monocypher'
ARGON2_LIB_PATH: '{{ .USER_WORKING_DIR }}/lib/Utils.Cryptography/argon2/{{ .NATIVE_BUILD_PATH }}{{ if eq OS "linux"}}lib{{end}}argon2'
cmds:
- cmd: echo "Ensure you have run 'task dev-init' before running tests to build native libraries"
silent: true
- cmd: dotnet build
--nologo
--configuration debug
--verbosity normal
--no-incremental
- cmd: dotnet test
--no-build
--nologo
--logger "console;verbosity=detailed"
--configuration debug
--framework {{ .TARGET_FRAMEWORK | default "net8.0" }}
--environment VNLIB_SHARED_HEAP_DIAGNOSTICS="1"
--environment TEST_RPMALLOC_LIB_PATH="{{ .RPMALLOC_LIB_PATH }}"
--environment TEST_MIMALLOC_LIB_PATH="{{ .MIMALLOC_LIB_PATH }}"
--environment VNLIB_COMPRESS_DLL_PATH="{{ .VNCOMPRESS_LIB_PATH }}"
--environment VNLIB_MONOCYPHER_DLL_PATH="{{ .MONOCYPHER_LIB_PATH }}"
--environment VNLIB_ARGON2_DLL_PATH="{{ .ARGON2_LIB_PATH }}"
{{ .CLI_ARGS }}
#run the web server tests without XML comment warnings
- cmd: cd apps/VNLib.WebServer && task test
#called by build pipeline to clean module
clean:
desc: "Used by vnbuild to clean the entire module"
ignore_error: true
cmds:
#clean solution
- cmd: dotnet clean
- cmd: rm -f '{{ .ARCHIVE_FILE_NAME }}'
- task: clean-native
dev-init:
desc: 'Configures the module (and native dependencies) for local development'
vars:
# the directories where native projects exist and need to be built
NATIVE_LIB_DIRS: '
lib/Utils.Memory/vnlib_rpmalloc
lib/Utils.Memory/vnlib_mimalloc
lib/Utils.Cryptography/monocypher
lib/Utils.Cryptography/argon2
lib/Net.Compression/vnlib_compress'
deps:
- for: { var: NATIVE_LIB_DIRS }
task: run-dev-init
vars: { ITEM: '{{ .ITEM }}' }
cmds:
- cmd: dotnet restore
- cmd: echo "Module developer initialization complete"
silent: true
run-dev-init:
internal: true
env:
CMAKE_BUILD_PARALLEL_LEVEL: '{{ .numCpu }}'
cmds:
- cmd: cd '{{ .ITEM }}' && task dev-init
clean-native:
desc: 'Cleans the native libraries for the module'
vars:
NATIVE_LIB_DIRS: '
lib/Utils.Memory/vnlib_rpmalloc
lib/Utils.Memory/vnlib_mimalloc
lib/Net.Compression/vnlib_compress
lib/Utils.Cryptography/monocypher
lib/Utils.Cryptography/argon2'
cmds:
- for: { var: NATIVE_LIB_DIRS }
cmd: cd {{ .ITEM }} && task clean
write-changelog:
cmds:
- cmd: git-cliff
--verbose
--config ci/cliff.toml
--output 'CHANGELOG.md'
--tag v{{ .VERSION }}
{{ .CLI_ARGS }}