From f3a3d385f0fc4099206e2887f5fc04d2ebe53aae Mon Sep 17 00:00:00 2001 From: "Dylan R. E. Moonfire" Date: Fri, 1 Apr 2022 23:30:27 -0500 Subject: [PATCH] build: switching setup for calculating Git versions --- .config/dotnet-tools.json | 18 ++++++++++++++++++ .gitignore | 3 +++ .gitlab/ci.yml => .gitlab-ci.yml | 6 +++--- .gitlab/build.sh | 3 --- .gitlab/release.sh | 3 --- TASKS.md | 2 ++ scripts/build.sh | 4 ++++ scripts/release.sh | 8 ++++++++ scripts/setup.sh | 2 ++ {.gitlab => scripts}/test.sh | 5 +++-- src/GitVersion.yml | 11 +++++++++++ 11 files changed, 54 insertions(+), 11 deletions(-) create mode 100644 .config/dotnet-tools.json rename .gitlab/ci.yml => .gitlab-ci.yml (83%) delete mode 100755 .gitlab/build.sh delete mode 100755 .gitlab/release.sh create mode 100755 scripts/build.sh create mode 100755 scripts/release.sh create mode 100644 scripts/setup.sh rename {.gitlab => scripts}/test.sh (82%) create mode 100644 src/GitVersion.yml diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..7720a5a --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,18 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "gitversion.tool": { + "version": "5.9.0", + "commands": [ + "dotnet-gitversion" + ] + }, + "dotnet-reportgenerator-globaltool": { + "version": "5.1.3", + "commands": [ + "reportgenerator" + ] + } + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index d128f9b..43bed09 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ obj/ _ReSharper.Caches/ node_modules/ .direnv/ +coverage +TestResults/ +tests/artifacts/ diff --git a/.gitlab/ci.yml b/.gitlab-ci.yml similarity index 83% rename from .gitlab/ci.yml rename to .gitlab-ci.yml index 5effae5..f9d9571 100644 --- a/.gitlab/ci.yml +++ b/.gitlab-ci.yml @@ -12,14 +12,14 @@ default: build: stage: build script: - - nix develop --command .gitlab/build.sh + - nix develop --command scripts/build.sh rules: - if: $CI_COMMIT_BRANCH test: stage: test script: - - nix develop --command .gitlab/test.sh + - nix develop --command scripts/test.sh artifacts: when: always paths: @@ -36,6 +36,6 @@ test: publish: stage: release script: - - nix develop --command .gitlab/release.sh + - nix develop --command scripts/release.sh rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH 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/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/TASKS.md b/TASKS.md index c312138..00e9c20 100644 --- a/TASKS.md +++ b/TASKS.md @@ -1,3 +1,5 @@ - [ ] Split out tables into an assembly - [ ] Switch to GitVersion for release - [ ] Switch to scripts instead of Node for targets +- [ ] Clean up the Gitlab setup + - [ ] Change configuration back to default diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..1e2a214 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env sh +cd $(dirname $0)/.. + +dotnet build diff --git a/scripts/release.sh b/scripts/release.sh new file mode 100755 index 0000000..b51d236 --- /dev/null +++ b/scripts/release.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh +cd $(dirname $0)/.. + +(cd src && dotnet dotnet-gitversion /updateprojectfiles) +dotnet clean +dotnet build +dotnet pack --include-symbols --include-source +dotnet nuget push src/*/bin/Debug/*.nupkg --api-key $NUGET_TOKEN --source $NUGET_PUSH_URL diff --git a/scripts/setup.sh b/scripts/setup.sh new file mode 100644 index 0000000..71414a4 --- /dev/null +++ b/scripts/setup.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +cd $(dirname $0)/.. diff --git a/.gitlab/test.sh b/scripts/test.sh similarity index 82% rename from .gitlab/test.sh rename to scripts/test.sh index 3b38e26..a8b4895 100755 --- a/.gitlab/test.sh +++ b/scripts/test.sh @@ -1,5 +1,6 @@ +#!/usr/bin/env sh +cd $(dirname $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/src/GitVersion.yml b/src/GitVersion.yml new file mode 100644 index 0000000..5eae0d2 --- /dev/null +++ b/src/GitVersion.yml @@ -0,0 +1,11 @@ +mode: MainLine +major-version-bump-message: "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)" +minor-version-bump-message: "^(feat)(\\([\\w\\s-]*\\))?:" +patch-version-bump-message: "^(build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:" +assembly-versioning-scheme: MajorMinorPatch +assembly-file-versioning-scheme: MajorMinorPatch +assembly-informational-format: '{InformationalVersion}' +mode: ContinuousDelivery +increment: Inherit +continuous-delivery-fallback-tag: ci +tag-prefix: '[vV]'