aboutsummaryrefslogtreecommitdiff
path: root/Module.Taskfile.yaml
blob: 8424a898fbec96d7ffe64142e96d4c6a1a99c64e (plain)
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
# 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'

tasks:

#called by build pipeline to sync repo
  update:
    cmds:
     - git reset --hard  
     - git remote update
     - git pull origin {{ .BRANCH_NAME }} --verify-signatures 

  test:
    desc: 'Builds and runs noscrypt unit tests for vnbuild CI systems'
    cmds:
     #ensure the debug library has been built for the current system before project tests are executed
     - cmd: task build-debug -- -DNC_ENABLE_UTILS=ON
     #library is already built, just need to test it
     - cmd: task test-dev 
     - task: test-dotnet     
  
     #runs the test suite inside wsl linux environment
     - cmd: echo 'Running WSL tests {{ if eq OS "windows" }}TRUE{{ else }}FALSE{{ end }}'
       silent: true   
     - cmd: wsl task test -- -DNC_ENABLE_UTILS=ON
       platforms: [ windows ]
     #run memory check
     - cmd: wsl task memcheck

  test-dotnet:
    vars:
      LIB_NAME: '{{ if eq OS "windows" }}noscrypt.dll{{ else }}libnoscrypt{{ end }}'
      LIB_PATH: '{{ .USER_WORKING_DIR }}/build/{{ OS }}/{{ if eq OS "windows" }}debug/{{ end }}{{ .LIB_NAME }}'
    
    cmds:
     - cmd: echo "running tests for {{ .PROJECT_NAME }}" 
       silent: true
     - cmd: dotnet test 
        {{ .CLI_ARGS }}
        --logger "console;verbosity=detailed"
        --framework {{ .FRAMEWORK | default "net8.0" }}   
        --configuration {{ .CONFIGURATION | default "Debug" }}     
        --environment VNLIB_SHARED_HEAP_DIAGNOSTICS="1"
        --environment 'NOSCRYPT_DLL_PATH="{{ osClean .LIB_PATH }}"'

#called by build pipeline to build module
  build:
    cmds: []
     
  publish:
    cmds:
     #git archive in the module directory
     - git archive --format {{.ARCHIVE_FILE_FORMAT}} --output {{.ARCHIVE_FILE_NAME}} HEAD

  #called by build pipeline to clean module
  clean:
    cmds:
     #clean solution
     - cmd: powershell -Command "rm out/ -Recurse "
       ignore_error: true