From 4fcb9c367ccac8927b20f75f99ac6034b9549038 Mon Sep 17 00:00:00 2001 From: "D. Moonfire" Date: Mon, 5 Sep 2022 22:17:10 -0500 Subject: [PATCH] build: preparing project layout --- .editorconfig | 198 ++++++++++++++++++------------------- .envrc | 3 +- .gitlab/build.sh | 3 - .gitlab/ci.yml | 41 -------- .gitlab/release.sh | 3 - .gitlab/test.sh | 5 - .woodpecker.yml | 36 +++++++ CHANGELOG.md | 36 ------- NuGet.Config | 16 +++ flake.lock | 12 +-- flake.nix | 11 ++- lefthook.yml | 22 +++++ scripts/README.md | 23 +++++ scripts/build.sh | 7 ++ scripts/format.sh | 4 + scripts/release.sh | 51 ++++++++++ scripts/setup.sh | 28 ++++++ scripts/test.sh | 8 ++ scripts/update-template.sh | 4 + 19 files changed, 315 insertions(+), 196 deletions(-) delete mode 100755 .gitlab/build.sh delete mode 100644 .gitlab/ci.yml delete mode 100755 .gitlab/release.sh delete mode 100755 .gitlab/test.sh create mode 100644 .woodpecker.yml delete mode 100644 CHANGELOG.md create mode 100644 NuGet.Config create mode 100644 lefthook.yml create mode 100644 scripts/README.md create mode 100755 scripts/build.sh create mode 100755 scripts/format.sh create mode 100755 scripts/release.sh create mode 100755 scripts/setup.sh create mode 100755 scripts/test.sh create mode 100755 scripts/update-template.sh diff --git a/.editorconfig b/.editorconfig index fc1b7bd..819c8e1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,120 +3,120 @@ root = true [*] -charset=utf-8 +charset = utf-8 end_of_line = lf -insert_final_newline=true -indent_style=space -indent_size=4 +insert_final_newline = true +indent_style = space +indent_size = 4 # Microsoft .NET properties -csharp_new_line_before_members_in_object_initializers=false -csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion -csharp_space_after_cast=false -csharp_style_var_elsewhere=false:hint -csharp_style_var_for_built_in_types=false:hint -csharp_style_var_when_type_is_apparent=true:hint -csharp_preserve_single_line_statements=false -csharp_preserve_single_line_blocks=true -dotnet_style_predefined_type_for_locals_parameters_members=true:hint -dotnet_style_predefined_type_for_member_access=true:hint -dotnet_style_qualification_for_event=true:hint -dotnet_style_qualification_for_field=true:hint -dotnet_style_qualification_for_method=true:hint -dotnet_style_qualification_for_property=true:hint -dotnet_style_require_accessibility_modifiers=for_non_interface_members:hint +csharp_new_line_before_members_in_object_initializers = false +csharp_preferred_modifier_order = public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion +csharp_space_after_cast = false +csharp_style_var_elsewhere = false:hint +csharp_style_var_for_built_in_types = false:hint +csharp_style_var_when_type_is_apparent = true:hint +csharp_preserve_single_line_statements = false +csharp_preserve_single_line_blocks = true +dotnet_style_predefined_type_for_locals_parameters_members = true:hint +dotnet_style_predefined_type_for_member_access = true:hint +dotnet_style_qualification_for_event = true:hint +dotnet_style_qualification_for_field = true:hint +dotnet_style_qualification_for_method = true:hint +dotnet_style_qualification_for_property = true:hint +dotnet_style_require_accessibility_modifiers = for_non_interface_members:hint # ReSharper properties -resharper_alignment_tab_fill_style=optimal_fill -resharper_apply_on_completion=true -resharper_blank_lines_after_control_transfer_statements=1 -resharper_blank_lines_around_single_line_auto_property=1 -resharper_blank_lines_around_single_line_property=1 -resharper_blank_lines_before_single_line_comment=1 -resharper_blank_lines_between_using_groups=1 -resharper_braces_for_for=required -resharper_braces_for_foreach=required -resharper_braces_for_ifelse=required -resharper_braces_for_while=required -resharper_can_use_global_alias=false -resharper_csharp_blank_lines_around_single_line_field=1 -resharper_csharp_blank_lines_around_single_line_invocable=1 -resharper_csharp_indent_style=tab -resharper_csharp_insert_final_newline=true -resharper_csharp_keep_blank_lines_in_code=1 -resharper_csharp_keep_blank_lines_in_declarations=1 -resharper_csharp_new_line_before_while=true -resharper_csharp_use_indent_from_vs=false -resharper_csharp_wrap_arguments_style=chop_if_long -resharper_csharp_wrap_extends_list_style=chop_if_long -resharper_csharp_wrap_parameters_style=chop_if_long -resharper_css_insert_final_newline=false -resharper_enforce_line_ending_style=true -resharper_html_insert_final_newline=false -resharper_indent_nested_fixed_stmt=true -resharper_js_indent_style=tab -resharper_js_insert_final_newline=true -resharper_js_keep_blank_lines_in_code=1 -resharper_js_stick_comment=false -resharper_js_use_indent_from_vs=false -resharper_js_wrap_before_binary_opsign=true -resharper_js_wrap_chained_method_calls=chop_if_long -resharper_keep_blank_lines_between_declarations=1 -resharper_min_blank_lines_after_imports=1 -resharper_place_attribute_on_same_line=False -resharper_place_constructor_initializer_on_same_line=false -resharper_place_type_constraints_on_same_line=false -resharper_protobuf_insert_final_newline=false -resharper_qualified_using_at_nested_scope=true -resharper_resx_insert_final_newline=false -resharper_space_within_single_line_array_initializer_braces=true -resharper_use_indents_from_main_language_in_file=false -resharper_vb_insert_final_newline=false -resharper_wrap_after_declaration_lpar=true -resharper_wrap_after_invocation_lpar=true -resharper_wrap_before_extends_colon=true -resharper_wrap_before_first_type_parameter_constraint=true -resharper_wrap_before_type_parameter_langle=true -resharper_xmldoc_indent_child_elements=ZeroIndent -resharper_xmldoc_indent_text=ZeroIndent -resharper_xmldoc_insert_final_newline=false -resharper_xml_insert_final_newline=false +resharper_alignment_tab_fill_style = optimal_fill +resharper_apply_on_completion = true +resharper_blank_lines_after_control_transfer_statements = 1 +resharper_blank_lines_around_single_line_auto_property = 1 +resharper_blank_lines_around_single_line_property = 1 +resharper_blank_lines_before_single_line_comment = 1 +resharper_blank_lines_between_using_groups = 1 +resharper_braces_for_for = required +resharper_braces_for_foreach = required +resharper_braces_for_ifelse = required +resharper_braces_for_while = required +resharper_can_use_global_alias = false +resharper_csharp_blank_lines_around_single_line_field = 1 +resharper_csharp_blank_lines_around_single_line_invocable = 1 +resharper_csharp_indent_style = tab +resharper_csharp_insert_final_newline = true +resharper_csharp_keep_blank_lines_in_code = 1 +resharper_csharp_keep_blank_lines_in_declarations = 1 +resharper_csharp_new_line_before_while = true +resharper_csharp_use_indent_from_vs = false +resharper_csharp_wrap_arguments_style = chop_if_long +resharper_csharp_wrap_extends_list_style = chop_if_long +resharper_csharp_wrap_parameters_style = chop_if_long +resharper_css_insert_final_newline = false +resharper_enforce_line_ending_style = true +resharper_html_insert_final_newline = false +resharper_indent_nested_fixed_stmt = true +resharper_js_indent_style = tab +resharper_js_insert_final_newline = true +resharper_js_keep_blank_lines_in_code = 1 +resharper_js_stick_comment = false +resharper_js_use_indent_from_vs = false +resharper_js_wrap_before_binary_opsign = true +resharper_js_wrap_chained_method_calls = chop_if_long +resharper_keep_blank_lines_between_declarations = 1 +resharper_min_blank_lines_after_imports = 1 +resharper_place_attribute_on_same_line = False +resharper_place_constructor_initializer_on_same_line = false +resharper_place_type_constraints_on_same_line = false +resharper_protobuf_insert_final_newline = false +resharper_qualified_using_at_nested_scope = true +resharper_resx_insert_final_newline = false +resharper_space_within_single_line_array_initializer_braces = true +resharper_use_indents_from_main_language_in_file = false +resharper_vb_insert_final_newline = false +resharper_wrap_after_declaration_lpar = true +resharper_wrap_after_invocation_lpar = true +resharper_wrap_before_extends_colon = true +resharper_wrap_before_first_type_parameter_constraint = true +resharper_wrap_before_type_parameter_langle = true +resharper_xmldoc_indent_child_elements = ZeroIndent +resharper_xmldoc_indent_text = ZeroIndent +resharper_xmldoc_insert_final_newline = false +resharper_xml_insert_final_newline = false # ReSharper inspection severities -resharper_check_namespace_highlighting=none -resharper_convert_to_auto_property_highlighting=none -resharper_localizable_element_highlighting=none -resharper_redundant_comma_in_attribute_list_highlighting=none -resharper_redundant_comma_in_enum_declaration_highlighting=none -resharper_redundant_comma_in_initializer_highlighting=none -resharper_string_compare_to_is_culture_specific_highlighting=none -resharper_string_index_of_is_culture_specific_1_highlighting=none -resharper_use_null_propagation_highlighting=none -resharper_use_object_or_collection_initializer_highlighting=hint -resharper_use_string_interpolation_highlighting=hint +resharper_check_namespace_highlighting = none +resharper_convert_to_auto_property_highlighting = none +resharper_localizable_element_highlighting = none +resharper_redundant_comma_in_attribute_list_highlighting = none +resharper_redundant_comma_in_enum_declaration_highlighting = none +resharper_redundant_comma_in_initializer_highlighting = none +resharper_string_compare_to_is_culture_specific_highlighting = none +resharper_string_index_of_is_culture_specific_1_highlighting = none +resharper_use_null_propagation_highlighting = none +resharper_use_object_or_collection_initializer_highlighting = hint +resharper_use_string_interpolation_highlighting = hint # Matches the exact files either package.json or .travis.yml [{package.json,.travis.yml}] -indent_style=space -indent_size=2 -tab_width=2 +indent_style = space +indent_size = 2 +tab_width = 2 [*.{cs,js,json,jsx,proto,resjson,ts,tsx}] -indent_style=space -indent_size=space -tab_width=4 +indent_style = space +indent_size = 4 +tab_width = 4 [*.{asax,ascx,aspx,cshtml,css,htm,html,master,razor,skin,vb,xaml,xamlx,xoml}] -indent_style=space -indent_size=4 -tab_width=4 +indent_style = space +indent_size = 4 +tab_width = 4 [*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,jsproj,lsproj,njsproj,nuspec,proj,props,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}] -indent_style=space -indent_size=2 -tab_width=2 +indent_style = space +indent_size = 2 +tab_width = 2 [*.proto] -indent_style=space -indent_size=2 -tab_width=2 +indent_style = space +indent_size = 2 +tab_width = 2 diff --git a/.envrc b/.envrc index 3550a30..5816063 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,2 @@ -use flake +export PATH=$PWD/scripts:$PATH +use flake || use nix diff --git a/.gitlab/build.sh b/.gitlab/build.sh deleted file mode 100755 index 10561a4..0000000 --- a/.gitlab/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -npm install --ci -npx commitlint-gitlab-ci -x @commitlint/config-conventional -npm run build diff --git a/.gitlab/ci.yml b/.gitlab/ci.yml deleted file mode 100644 index 5effae5..0000000 --- a/.gitlab/ci.yml +++ /dev/null @@ -1,41 +0,0 @@ -include: - - template: Security/SAST.gitlab-ci.yml - -stages: - - build - - test - - release - -default: - image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest - -build: - stage: build - script: - - nix develop --command .gitlab/build.sh - rules: - - if: $CI_COMMIT_BRANCH - -test: - stage: test - script: - - nix develop --command .gitlab/test.sh - artifacts: - when: always - paths: - - ./**/*test-result.xml - - ./coverage/Cobertura.xml - - ./coverage/Summary.* - - ./**/*.nupkg - reports: - junit: - - ./**/*test-result.xml - cobertura: - - ./coverage/Cobertura.xml - -publish: - stage: release - script: - - nix develop --command .gitlab/release.sh - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/.gitlab/release.sh b/.gitlab/release.sh deleted file mode 100755 index 90f5c48..0000000 --- a/.gitlab/release.sh +++ /dev/null @@ -1,3 +0,0 @@ -npm install --ci -npm run build -npx semantic-release diff --git a/.gitlab/test.sh b/.gitlab/test.sh deleted file mode 100755 index 6f7b13e..0000000 --- a/.gitlab/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage" -#dotnet new tool-manifest -#dotnet tool install dotnet-reportgenerator-globaltool -#dotnet tool run reportgenerator -reports:tests/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary" -#grep "Line coverage" coverage/Summary.txt diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..3f25d63 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,36 @@ +clone: + git: + image: woodpeckerci/plugin-git + settings: + tags: true + +pipeline: + build: + image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest + commands: + - nix develop --command scripts/build.sh + when: + event: [push, pull_request, tag] + tag: v* + + test: + image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest + commands: + - nix develop --command scripts/test.sh + when: + event: [push, pull_request] + #paths: + # - ./**/*test-result.xml + # - ./coverage/Cobertura.xml + # - ./coverage/Summary.* + # - ./**/*.nupkg + + release-main: + image: registry.gitlab.com/dmoonfire/nix-flake-docker:latest + commands: + - nix develop --command scripts/release.sh + secrets: + - gitea_token + when: + event: push + branch: main diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index bba4d30..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,36 +0,0 @@ -## [1.0.4](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/compare/v1.0.3...v1.0.4) (2021-09-11) - - -### Bug Fixes - -* **nuget:** fixing packaging and versioning ([a6fe769](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/commit/a6fe769feb307c1d85534b603d045bd9fbb37778)) -* **nuget:** fixing packaging and versioning ([1e8dd7a](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/commit/1e8dd7a9a9d69d13173e513ab8fcb3116bd04f8b)) -* **nuget:** fixing packaging and versioning ([4941485](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/commit/4941485989daedf64e9ff73493305a71e7023c6e)) - -## [1.0.3](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/compare/v1.0.2...v1.0.3) (2021-09-10) - - -### Bug Fixes - -* test output should go to the Xunit output ([d7902d2](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/commit/d7902d215aba596a42b7c2e11e3483bb4067e674)) - -## [1.0.2](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/compare/v1.0.1...v1.0.2) (2021-09-10) - - -### Bug Fixes - -* **nuget:** adding description ([40745c5](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/commit/40745c524f062982eeb75854b47ff08191446fa5)) - -## [1.0.1](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/compare/v1.0.0...v1.0.1) (2021-09-10) - - -### Bug Fixes - -* correcting NuGet packaging ([87cf2f9](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/commit/87cf2f91c4ab2a499f1d1ddcfd5590fe66e3f9ae)) - -# 1.0.0 (2021-09-10) - - -### Features - -* initial commit ([abecc1f](https://gitlab.com/mfgames-cil/mfgames-testsetup-cil/commit/abecc1f34cfb0efcc6d30c59ae00f781566ab4c3)) diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..ff47af7 --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/flake.lock b/flake.lock index 4c57fd5..b67b61d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "flake-utils": { "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -17,11 +17,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1638806821, - "narHash": "sha256-v2qd2Bsmzft53s43eCbN+4ocrLksRdFLyF/MAGuWuDA=", + "lastModified": 1662019588, + "narHash": "sha256-oPEjHKGGVbBXqwwL+UjsveJzghWiWV0n9ogo1X6l4cw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "bc5d68306b40b8522ffb69ba6cff91898c2fbbff", + "rev": "2da64a81275b68fdad38af669afeda43d401e94b", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index d6a1166..3de25d3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "A .NET core library for building tools"; + description = "A .NET core library for easily building CLI tools"; inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; @@ -11,7 +11,14 @@ let pkgs = nixpkgs.legacyPackages.${system}; in { devShell = pkgs.mkShell { - buildInputs = [ pkgs.dotnet-sdk_5 pkgs.nodejs-16_x pkgs.nixfmt ]; + buildInputs = [ + pkgs.dotnet-sdk + pkgs.lefthook + pkgs.convco + pkgs.nodePackages.prettier + pkgs.nixfmt + pkgs.jq + ]; }; }); } diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..43a0f2b --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,22 @@ +pre-commit: + parallel: true + commands: + dotnet-format: + glob: "*.cs" + run: dotnet format + prettier: + run: prettier . --write --loglevel warn + nixfmt: + run: nixfmt flake.nix + +commit-msg: + commands: + commit-check: + run: convco check -n 1 + +skip_output: + - meta # Skips lefthook version printing + - summary # Skips summary block (successful and failed steps) printing + - success # Skips successful steps printing + - failure # Skips failed steps printing + - execution # Skips printing successfully executed commands and their output (but still prints failed executions) diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..f357938 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,23 @@ +# Scripts Directory + +This directory contains the basic scripts for working with the library. + +## `setup.sh` + +This verifies the environment is correct and makes sure everything is configured. + +## `build.sh` + +This builds the project and creates the binaries in debug mode. + +## `test.sh` + +This runs any required tests. + +## `format.sh` + +This is used to format the code base using our standards. It matches the commands in the `lefthook` pre-commit hook. + +## `release.sh` + +Intended to run in a CI environment, this creates a NuGet package and publishes it. diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..66f32c5 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +cd $(dirname $0)/.. +./scripts/setup.sh || exit 1 + +echo "$(basename $0): building project" +dotnet build diff --git a/scripts/format.sh b/scripts/format.sh new file mode 100755 index 0000000..7b31af0 --- /dev/null +++ b/scripts/format.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +cd $(dirname $0)/.. +lefthook run pre-commit diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..94ed900 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env sh + +cd $(dirname $0)/.. +./scripts/setup.sh || exit 1 + +# Verify the input. +if [ "x$GITEA_TOKEN" = "x" ] +then + echo "the environment variable GITEA_TOKEN is not defined" + exit 1 +fi + +# Clean up everything from the previous runs. +echo "$(basename $0): cleaning project" +dotnet clean + +# Version the file based on the Git repository. +echo "$(basename $0): setting project version" +(cd src && dotnet dotnet-gitversion /updateprojectfiles) +SEMVER="v$(dotnet gitversion /output json | jq -r .SemVer)" + +if [ "x$SEMVER" = "x" ] +then + echo "$(basename $0): cannot figure out the semantic version" + exit 1 +fi + +# Build to pick up the new version. +echo "$(basename $0): building project $SEMVER" +dotnet build || exit 1 + +# Create and publish the NuGet packages. +echo "$(basename $0): creating NuGet packages" +dotnet pack -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg || exit 1 + +echo "$(basename $0): publishing NuGet package" +dotnet nuget remove source mfgames.com >& /dev/null +dotnet nuget add source --name mfgames.com --username dmoonfire --password $GITEA_TOKEN https://src.mfgames.com/api/packages/mfgames-cil/nuget/index.json --store-password-in-clear-text || exit 1 +dotnet nuget push --skip-duplicate --source mfgames.com src/*/bin/Debug/*.nupkg || exit 1 + +# Tag and push, but only if we don't have a tag. +if ! git tag | grep $SEMVER >& /dev/null +then + echo "$(basename $0): tagging and pushing" + git remote add publish https://dmoonfire:$GITEA_TOKEN@src.mfgames.com/mfgames-cil/$(basename $(git config --get remote.origin.url)) + git tag $SEMVER + git push publish $SEMVER || exit 1 + git remote remove publish +else + echo "$(basename $0): not tagging, already exists" +fi diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100755 index 0000000..3ee77ae --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +# Normalize our environment. +cd $(dirname $0)/.. + +# Make sure we have the needed executables installed. +for e in dotnet lefthook prettier nixfmt +do + if ! which $e >& /dev/null + then + echo "Cannot find '$e' in the path" + exit 1 + fi +done + +# Make sure we have lefthook is installed. +if [ ! -f .git/hooks/pre-commit ] +then + echo "$(basename $0): installing lefthook" + lefthook install +fi + +# Make sure our tools are installed. +echo "$(basename $0): install .NET tools" +dotnet tool restore + +# Everything is good. +exit 0 diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..bb106ee --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +cd $(dirname $0)/.. +./scripts/setup.sh || exit 1 + +dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage" +dotnet tool run reportgenerator -reports:tests/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary" +grep "Line coverage" coverage/Summary.txt diff --git a/scripts/update-template.sh b/scripts/update-template.sh new file mode 100755 index 0000000..2d80710 --- /dev/null +++ b/scripts/update-template.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh + +cd $(dirname $0)/.. +git pull template main --no-rebase