aboutsummaryrefslogtreecommitdiff
path: root/Taskfile.yaml
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-10-17 23:33:46 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-10-17 23:33:46 -0400
commitdc47d096400e7a4d95dd9516c72876c8ad016dcb (patch)
tree579dc884569c5acdac6a790cedcc4ffe40bba48f /Taskfile.yaml
parent0cae8cabf8fae1cf068cc026bd8b07b134d47284 (diff)
update CI tests and run cross-platform unit testing
Diffstat (limited to 'Taskfile.yaml')
-rw-r--r--Taskfile.yaml98
1 files changed, 58 insertions, 40 deletions
diff --git a/Taskfile.yaml b/Taskfile.yaml
index cbc4a7a..b19a135 100644
--- a/Taskfile.yaml
+++ b/Taskfile.yaml
@@ -15,6 +15,7 @@ version: '3'
vars:
CMAKE_BUILD_DIR: 'build/{{ OS }}'
TEST_EXE_NAME: 'nctest'
+ CI_BUILD_CONFIG: '{{ .CI_BUILD_CONFIG | default "Release" }}'
tasks:
@@ -35,7 +36,7 @@ tasks:
desc: "Builds a local copy of the library in a debug configuration, then runs the test executable"
cmds:
- task: build-debug
- - cmd: cd {{.CMAKE_BUILD_DIR}} && ctest -C Debug --verbose
+ - cmd: cd {{ .CMAKE_BUILD_DIR }} && ctest -C Debug --verbose
test-mbedtls:
desc: "Builds and runs tests for noscrypt using the mbedtls crypto library for the current platform"
@@ -44,36 +45,45 @@ tasks:
vars:
CMAKE_TEST_STATUS: 'ON'
BUILD_CONFIG: 'Debug'
- CLI_ARGS: '-DNC_FETCH_MBEDTLS=ON {{.CLI_ARGS}}' #fetches and enabled medtls
- - cmd: cd {{.CMAKE_BUILD_DIR}} && ctest -C Debug --verbose
+ CLI_ARGS: '-DNC_FETCH_MBEDTLS=ON {{ .CLI_ARGS }}' #fetches and enabled medtls
+
+ - cmd: cd {{ .CMAKE_BUILD_DIR }} && ctest -C Debug --verbose
test-dev:
desc: "Re-runs compilation phase and test execution"
cmds:
- task: compile
vars: { BUILD_CONFIG: 'Debug' }
- - cmd: cd {{.CMAKE_BUILD_DIR}} && ctest -C Debug --verbose --output-on-failure
-
- compile:
- internal: true
- cmds:
- - cmake --build {{.CMAKE_BUILD_DIR}} --config {{.BUILD_CONFIG}}
+ - cmd: cd {{ .CMAKE_BUILD_DIR }} && ctest -C Debug --verbose --output-on-failure
build-internal:
internal: true
cmds:
- - cmake -S . -B{{.CMAKE_BUILD_DIR}} -DCMAKE_BUILD_TYPE={{.BUILD_CONFIG}} -DNC_BUILD_TESTS={{ .CMAKE_TEST_STATUS }} {{.CLI_ARGS}}
+ - cmd: cmake {{ .CLI_ARGS }}
+ -S .
+ -B{{ .CMAKE_BUILD_DIR }}
+ -DCMAKE_BUILD_TYPE={{ .BUILD_CONFIG }}
+ -DNC_BUILD_TESTS={{ .CMAKE_TEST_STATUS }}
+
- task: compile
- vars: { BUILD_CONFIG: '{{.BUILD_CONFIG}}' }
- - cmd: echo "Build complete. Your files can be found in the {{.CMAKE_BUILD_DIR}} directory"
+ vars: { BUILD_CONFIG: '{{ .BUILD_CONFIG }}' }
+
+ - cmd: echo "Build complete. Your files can be found in the {{ .CMAKE_BUILD_DIR }} directory"
silent: true
+ compile:
+ internal: true
+ cmds:
+ - cmd: cmake
+ --build {{ .CMAKE_BUILD_DIR }}
+ --config {{ .BUILD_CONFIG }}
+
install:
desc: "Uses cmake to install the library on your system"
cmds:
- cmd: echo "Installing noscrypt globally"
silent: true
- - cmd: cmake --install {{.CMAKE_BUILD_DIR}} {{.CLI_ARGS}}
+ - cmd: cmake --install {{ .CMAKE_BUILD_DIR }} {{ .CLI_ARGS }}
#CI ONLY!!
@@ -81,7 +91,7 @@ tasks:
#called by build pipeline to build module
build:
cmds:
- - echo "building project {{.PROJECT_NAME}}"
+ - echo "building project {{ .PROJECT_NAME }}"
- cmd: powershell -Command "mkdir bin/ -Force"
ignore_error: true
@@ -97,51 +107,59 @@ tasks:
cmds:
- for: [ bin/, build/ ]
task: clean-internal
- vars: { FILE: '{{.ITEM}}'}
+ vars: { FILE: '{{ .ITEM }}'}
clean-internal:
internal: true
ignore_error: true
cmds:
- - cmd: rm -rf '{{.FILE}}'
+ - cmd: rm -rf '{{ .FILE }}'
platforms: [linux, darwin]
- - cmd: powershell rm -Recurse -Force '{{.FILE}}'
+ - cmd: powershell rm -Recurse -Force '{{ .FILE }}'
platforms: [windows]
build_win_x64:
internal: true
+ platforms: [ windows ]
vars:
- TARGET_DLL: '{{.PROJECT_DIR}}/{{.BINARY_DIR}}/msvc-x64-release-{{.PROJECT_NAME}}.tgz'
- DLL_FILES: '{{.PROJECT_NAME}}.dll {{.PROJECT_NAME}}.lib license.txt'
- TARGET_STATIC: '{{.PROJECT_DIR}}/{{.BINARY_DIR}}/msvc-x64-release-{{.PROJECT_NAME}}-static.tgz'
- STATIC_FILES: '{{.PROJECT_NAME}}_static.lib license.txt'
+ TARGET: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}/msvc-x64-{{ .CI_BUILD_CONFIG }}-{{ .PROJECT_NAME }}.tgz'
BUILD_DIR: 'build/win-x64'
+
+ TAR_FILES: "
+ {{ .PROJECT_NAME }}.dll
+ {{ .PROJECT_NAME }}.lib
+ {{ .PROJECT_NAME }}_static.lib
+ license.txt"
cmds:
#remove deps dir to avoid conflicts with vnbuild
- defer: powershell rm -Recurse -Force "{{ .BUILD_DIR }}/_deps"
#invoke cmake build
- - cmake -S . -B {{.BUILD_DIR}} -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -DNC_BUILD_TESTS=OFF
- - cmake --build {{.BUILD_DIR}} --config Release
+ - cmd: cmake
+ -S .
+ -B {{ .BUILD_DIR }}
+ -G "Visual Studio 17 2022"
+ -A x64
+ -DCMAKE_BUILD_TYPE={{ .CI_BUILD_CONFIG }}
+ -DNC_BUILD_TESTS=OFF
+
+ - cmake --build {{ .BUILD_DIR }} --config {{ .CI_BUILD_CONFIG }}
#copy license to build dir
- - powershell -Command "cp license {{.BUILD_DIR}}/Release/license.txt"
+ - cmd: powershell cp license '{{ .BUILD_DIR }}/Release/license.txt'
#tar up the binaries
- - cd {{.BUILD_DIR}}/Release && tar -czf "{{.TARGET_DLL}}" {{.DLL_FILES}}
-
- #tar up static libs
- - cd {{.BUILD_DIR}}/Release && tar -czf "{{.TARGET_STATIC}}" {{.STATIC_FILES}}
+ - cmd: cd {{ .BUILD_DIR }}/Release && tar -czf "{{ .TARGET }}" {{ .TAR_FILES }}
pack_source:
internal: true
desc: "Packs up the project source code and creates a tarball in the builds binary directory"
vars:
- TARGET_SOURCE: '{{.PROJECT_DIR}}/{{.BINARY_DIR}}/{{.PROJECT_NAME}}-src.tgz'
+ TARGET_SOURCE: '{{ .PROJECT_DIR }}/{{ .BINARY_DIR }}/{{ .PROJECT_NAME }}-src.tgz'
SOURCE_FILES:
CMakeLists.txt
Taskfile.yaml
@@ -155,7 +173,7 @@ tasks:
cmds:
#tar up the source
- - tar -czf "{{.TARGET_SOURCE}}" {{ .SOURCE_FILES | join " " }}
+ - tar -czf "{{ .TARGET_SOURCE }}" {{ .SOURCE_FILES | join " " }}
#################################
#
@@ -170,7 +188,7 @@ tasks:
cmds:
- task: compile
vars: { BUILD_CONFIG: 'Debug' }
- - cmd: gdb '{{.CMAKE_BUILD_DIR}}/{{.TEST_EXE_NAME}}'
+ - cmd: gdb '{{ .CMAKE_BUILD_DIR }}/{{ .TEST_EXE_NAME }}'
dev-update-deps:
desc: "Updates vendored projects files (headers mostly) from their source repositories to the latest version"
@@ -188,13 +206,13 @@ tasks:
MC_DIR: 'vendor/monocypher'
TMP_DIR: '.update/mc'
cmds:
- - cmd: powershell mkdir '{{.TMP_DIR}}' -Force
+ - cmd: powershell mkdir '{{ .TMP_DIR }}' -Force
ignore_error: true
- - git clone --branch {{.MC_GIT_BRANCH}} {{.MC_GIT_URL}} '{{.TMP_DIR}}'
+ - git clone --branch {{ .MC_GIT_BRANCH }} {{ .MC_GIT_URL }} '{{ .TMP_DIR }}'
- for: [ 'src/monocypher.h', 'src/monocypher.c' ]
- cmd: powershell cp '{{.TMP_DIR}}/{{.ITEM}}' '{{.MC_DIR}}'
+ cmd: powershell cp '{{ .TMP_DIR }}/{{ .ITEM }}' '{{ .MC_DIR }}'
dev-update-mbedtls-headers:
vars:
@@ -203,13 +221,13 @@ tasks:
MBEDTLS_DIR: 'vendor/mbedtls'
TMP_DIR: '.update/mbedtls'
cmds:
- - cmd: powershell mkdir '{{.TMP_DIR}}' -Force
+ - cmd: powershell mkdir '{{ .TMP_DIR }}' -Force
ignore_error: true
- git clone --branch {{ .MBEDTLS_GIT_BRANCH }} {{ .MBEDTLS_GIT_URL }} '{{ .TMP_DIR }}'
- for: [ 'include/mbedtls' ]
- cmd: powershell cp -Recurse -Force '{{ .TMP_DIR }}/{{ .ITEM }}' '{{.MBEDTLS_DIR}}/include'
+ cmd: powershell cp -Recurse -Force '{{ .TMP_DIR }}/{{ .ITEM }}' '{{ .MBEDTLS_DIR }}/include'
dev-update-openssl-headers:
vars:
@@ -218,13 +236,13 @@ tasks:
OPENSSL_DIR: 'vendor/openssl'
TMP_DIR: '.update/openssl'
cmds:
- - cmd: powershell mkdir '{{.TMP_DIR}}' -Force
+ - cmd: powershell mkdir '{{ .TMP_DIR }}' -Force
ignore_error: true
- git clone --branch {{ .OPENSSL_GIT_BRANCH }} {{ .OPENSSL_GIT_URL }} '{{ .TMP_DIR }}'
- for: [ 'include/openssl' ]
- cmd: powershell cp -Recurse -Force '{{ .TMP_DIR }}/{{ .ITEM }}' '{{.OPENSSL_DIR}}/include/'
+ cmd: powershell cp -Recurse -Force '{{ .TMP_DIR }}/{{ .ITEM }}' '{{ .OPENSSL_DIR }}/include/'
dev-set-secp256-headers:
vars:
@@ -233,10 +251,10 @@ tasks:
SECP256_DIR: 'vendor/secp256k1'
TMP_DIR: '.update/secp256k1'
cmds:
- - cmd: powershell mkdir '{{.TMP_DIR}}' -Force
+ - cmd: powershell mkdir '{{ .TMP_DIR }}' -Force
ignore_error: true
- git clone --branch {{ .SECP256_GIT_BRANCH }} {{ .SECP256_GIT_URL }} '{{ .TMP_DIR }}'
- for: [ 'include/*' ]
- cmd: powershell cp -Recurse -Force '{{ .TMP_DIR }}/{{ .ITEM }}' '{{.SECP256_DIR}}/include/secp256k1/' \ No newline at end of file
+ cmd: powershell cp -Recurse -Force '{{ .TMP_DIR }}/{{ .ITEM }}' '{{ .SECP256_DIR }}/include/secp256k1/' \ No newline at end of file