build: switching setup for calculating Git versions

This commit is contained in:
Dylan R. E. Moonfire 2022-04-01 23:30:27 -05:00
parent 0298ae601e
commit f3a3d385f0
11 changed files with 54 additions and 11 deletions

18
.config/dotnet-tools.json Normal file
View file

@ -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"
]
}
}
}

3
.gitignore vendored
View file

@ -12,3 +12,6 @@ obj/
_ReSharper.Caches/
node_modules/
.direnv/
coverage
TestResults/
tests/artifacts/

View file

@ -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

View file

@ -1,3 +0,0 @@
npm install --ci
npx commitlint-gitlab-ci -x @commitlint/config-conventional
npm run build

View file

@ -1,3 +0,0 @@
npm install --ci
npm run build
npx semantic-release

View file

@ -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

4
scripts/build.sh Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
cd $(dirname $0)/..
dotnet build

8
scripts/release.sh Executable file
View file

@ -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

2
scripts/setup.sh Normal file
View file

@ -0,0 +1,2 @@
#!/usr/bin/env sh
cd $(dirname $0)/..

View file

@ -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

11
src/GitVersion.yml Normal file
View file

@ -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]'