gitversion fix

This commit is contained in:
Miha Kralj
2024-10-12 22:46:36 -07:00
parent b3b3b24a25
commit 2236f5f483
8 changed files with 35 additions and 233 deletions
+23 -32
View File
@@ -70,9 +70,9 @@ jobs:
run: | run: |
dotnet build --no-restore --configuration Debug dotnet build --no-restore --configuration Debug
dotnet build ./lib/quantalib.csproj --configuration Release --nologo dotnet build ./lib/quantalib.csproj --configuration Release --nologo
dotnet build ./quantower/Averages/Averages.csproj --configuration Release --nologo dotnet build ./quantower/Averages/_Averages.csproj --configuration Release --nologo
dotnet build ./quantower/Statistics/Statistics.csproj --configuration Release --nologo dotnet build ./quantower/Statistics/_Statistics.csproj --configuration Release --nologo
dotnet build ./quantower/Volatility/Volatility.csproj --configuration Release --nologo dotnet build ./quantower/Volatility/_Volatility.csproj --configuration Release --nologo
dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo
dotnet dotcover test Tests/Tests.csproj --dcReportType=HTML --dcoutput=./dotcover.html dotnet dotcover test Tests/Tests.csproj --dcReportType=HTML --dcoutput=./dotcover.html
@@ -107,9 +107,9 @@ jobs:
run: | run: |
dotnet build --no-restore --configuration Debug dotnet build --no-restore --configuration Debug
dotnet build ./lib/quantalib.csproj --configuration Release --nologo dotnet build ./lib/quantalib.csproj --configuration Release --nologo
dotnet build ./quantower/Averages/Averages.csproj --configuration Release --nologo dotnet build ./quantower/Averages/_Averages.csproj --configuration Release --nologo
dotnet build ./quantower/Statistics/Statistics.csproj --configuration Release --nologo dotnet build ./quantower/Statistics/_Statistics.csproj --configuration Release --nologo
dotnet build ./quantower/Volatility/Volatility.csproj --configuration Release --nologo dotnet build ./quantower/Volatility/_Volatility.csproj --configuration Release --nologo
dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo
- name: Run Tests with Coverage - name: Run Tests with Coverage
@@ -262,31 +262,25 @@ jobs:
run: | run: |
dotnet build ./lib/quantalib.csproj --configuration Release --nologo \ dotnet build ./lib/quantalib.csproj --configuration Release --nologo \
-p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }} -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
dotnet build ./quantower/Averages/Averages.csproj --configuration Release --nologo dotnet build ./quantower/Averages/_Averages.csproj --configuration Release --nologo
dotnet build ./quantower/Statistics/Statistics.csproj --configuration Release --nologo dotnet build ./quantower/Statistics/_Statistics.csproj --configuration Release --nologo
dotnet build ./quantower/Volatility/Volatility.csproj --configuration Release --nologo dotnet build ./quantower/Volatility/_Volatility.csproj --configuration Release --nologo
dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo
############# Publish dev release ############# Publish dev release
- name: Update Development Release - name: Create or Update Development Release
if: github.ref == 'refs/heads/dev' if: github.ref == 'refs/heads/dev'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MYGET_URL: https://www.myget.org/feed/quantalib/package/nuget/QuanTAlib
PACKAGE_VERSION: ${{ steps.gitversion.outputs.NuGetVersion }}
run: | run: |
tag_name="development" gh release delete development --yes || true
release_name="Development Build" gh release create development \
gh release delete $tag_name --yes || true --title "Development Build" \
git push origin :refs/tags/$tag_name || true --notes "Latest development build from commit ${{ github.sha }}" \
gh release create $tag_name \
--title "$release_name" \
--notes "Latest development build from commit ${{ github.sha }}
MyGet Package: [$MYGET_URL/$PACKAGE_VERSION]($MYGET_URL/$PACKAGE_VERSION) \n" \
--prerelease \ --prerelease \
--target ${{ github.sha }} \ --target ${{ github.sha }} \
lib/bin/Release/QuanTAlib.dll \
quantower/Averages/bin/Release/Averages.dll \ quantower/Averages/bin/Release/Averages.dll \
quantower/Statistics/bin/Release/Statistics.dll \ quantower/Statistics/bin/Release/Statistics.dll \
quantower/Volatility/bin/Release/Volatility.dll \ quantower/Volatility/bin/Release/Volatility.dll \
@@ -302,20 +296,17 @@ jobs:
############## Publish main release ############## Publish main release
- name: Publish release assets - name: Create GitHub Release
if: ${{ github.ref == 'refs/heads/main' }} if: ${{ github.ref == 'refs/heads/main' }}
uses: SourceSprint/upload-multiple-releases@1.0.7
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: run: |
prerelease: false gh release create v${{ steps.gitversion.outputs.MajorMinorPatch }} \
overwrite: true --title "Release ${{ steps.gitversion.outputs.MajorMinorPatch }}" \
release_name: ${{ steps.gitversion.outputs.MajorMinorPatch }} --notes "Release notes for version ${{ steps.gitversion.outputs.MajorMinorPatch }}" \
tag_name: latest quantower/Averages/bin/Release/Averages.dll \
release_config: | quantower/Statistics/bin/Release/Statistics.dll \
quantower/Averages/bin/Release/Averages.dll quantower/Volatility/bin/Release/Volatility.dll \
quantower/Statistics/bin/Release/Statistics.dll
quantower/Volatility/bin/Release/Volatility.dll
SyntheticVendor/bin/Release/SyntheticVendor.dll SyntheticVendor/bin/Release/SyntheticVendor.dll
- name: Push release package to nuget.org - name: Push release package to nuget.org
-165
View File
@@ -1,165 +0,0 @@
name: Stage/build/test/release/publish
on:
workflow_dispatch:
jobs:
build_test:
#runs-on: windows-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
############## Install tools
- name: Create Quantower folder at root
run: |
sudo mkdir -p /Quantower/
sudo chmod -R 777 /Quantower
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '6.x'
includePrerelease: true
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
#configFilePath: GitVersion.yml
updateAssemblyInfo: true
############## Install more tools
- name: Install JDK11 for Sonar Scanner
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
- name: Install JetBrains
run: dotnet tool install JetBrains.dotCover.GlobalTool --global
- name: Install Sonar Scanner
run: dotnet tool install dotnet-sonarscanner --global
- name: Install dotnet-coverage
run: dotnet tool install dotnet-coverage --global
- name: Sonar start
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib"
/d:sonar.login="${{ secrets.SONAR_TOKEN }}"
/d:sonar.host.url="https://sonarcloud.io"
/d:sonar.cs.dotcover.reportsPaths=dotcover*
############# Build and test
- name: Build projects
run: |
dotnet build ./lib/quantalib.csproj --configuration Release --nologo \
-p:PackageVersion=${{ github.ref == 'refs/heads/dev' && steps.gitversion.outputs.FullSemVer || steps.gitversion.outputs.MajorMinorPatch }}
dotnet build ./quantower/Averages/Averages.csproj --configuration Release --nologo
dotnet build ./quantower/Statistics/Statistics.csproj --configuration Release --nologo
dotnet build ./quantower/Volatility/Volatility.csproj --configuration Release --nologo
dotnet build ./SyntheticVendor/SyntheticVendor.csproj --configuration Release --nologo
- name: DotCover Test HTML
if: ${{ github.ref == 'refs/heads/dev' }}
run: dotnet dotcover test tests/tests.csproj --dcReportType=HTML --dcoutput=./dotcover.html
- name: DotCover Test XML
if: ${{ github.ref == 'refs/heads/dev' }}
run: dotnet dotcover test tests/tests.csproj --dcReportType=DetailedXML --dcoutput=./dotcover.xml --verbosity=Detailed
- name: Coverlet Test
if: ${{ github.ref == 'refs/heads/dev' }}
run: dotnet test -p:CollectCoverage=true --collect:"XPlat Code Coverage" --results-directory "./"
############## Report to Sonar/CodeCov/Codacy
- name: Move coverage report to project root
if: ${{ github.ref == 'refs/heads/dev' }}
run: |
dotnet test ./Tests/Tests.csproj --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput="./TestResults/"
dotnet-coverage collect "dotnet test" -f xml -o "coverage.xml"
- name: Upload to Codacy
if: ${{ github.ref == 'refs/heads/dev' }}
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: "*cover*.xml"
- name: Upload to Codecov
if: ${{ github.ref == 'refs/heads/dev' }}
uses: codecov/codecov-action@v3
with:
files: cover*
verbose: true
- name: Upload to Sonar
if: ${{ github.ref == 'refs/heads/dev' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
############## Publish dev release
- name: Publish dev release assets
if: ${{ github.ref == 'refs/heads/dev' }}
uses: SourceSprint/upload-multiple-releases@1.0.7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: true
overwrite: true
release_name: ${{ steps.gitversion.outputs.SemVer }}
tag_name: prerelease
release_config: |
lib/bin/Release/QuanTAlib.dll
quantower/Averages/bin/Release/Averages.dll
quantower/Statistics/bin/Release/Statistics.dll
SyntheticVendor/bin/Release/SyntheticVendor.dll
- name: Push package to myget.org
run: dotnet nuget push 'lib/bin/Release/QuanTAlib.*.nupkg'
--api-key ${{ secrets.MYGET_DEPLOY_KEY_QUANTALIB }}
--source https://www.myget.org/F/quantalib/api/v2/package
--skip-duplicate
############## Publish main release
- name: Publish main release assets
if: ${{ github.ref == 'refs/heads/main' }}
uses: SourceSprint/upload-multiple-releases@1.0.7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: false
overwrite: true
release_name: ${{ steps.gitversion.outputs.MajorMinorPatch }}
tag_name: latest
release_config: |
lib/bin/Release/QuanTAlib.dll
quantower/Averages/bin/Release/Averages.dll
quantower/Statistics/bin/Release/Statistics.dll
quantower/Volatility/bin/Release/Volatility.dll
SyntheticVendor/bin/Release/SyntheticVendor.dll
- name: Push package to nuget.org
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push 'lib/bin/Release/QuanTAlib.*.nupkg'
--api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate
+6 -35
View File
@@ -1,46 +1,17 @@
mode: ContinuousDeployment mode: ContinuousDelivery
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
tag-prefix: '[vV]?'
major-version-bump-message: '\+semver:\s?(breaking|major)' major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)' minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)' patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)' no-bump-message: '\+semver:\s?(none|skip)'
commit-message-incrementing: Enabled
branches: branches:
main: main:
regex: ^main$ regex: ^main$
mode: ContinuousDeployment mode: ContinuousDelivery
label: ''
increment: Patch increment: Patch
track-merge-target: false
source-branches: []
tracks-release-branches: false
is-release-branch: true
pre-release-weight: 55000
dev: dev:
regex: ^dev$ regex: ^dev(elop)?(ment)?$
mode: ContinuousDelivery mode: ContinuousDeployment
label: '' increment: Inherit
increment: Patch
track-merge-target: true
source-branches: ['main']
tracks-release-branches: true
is-release-branch: false
pre-release-weight: 0
develop:
regex: ^develop$
mode: ContinuousDelivery
label: ''
increment: Patch
track-merge-target: true
source-branches: ['main']
tracks-release-branches: true
is-release-branch: false
pre-release-weight: 0
ignore: ignore:
sha: [] sha: []
merge-message-formats: {}
+1
View File
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<AlgoType>Vendor</AlgoType> <AlgoType>Vendor</AlgoType>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
+1
View File
@@ -12,6 +12,7 @@
<PackageReadmeFile>readme.md</PackageReadmeFile> <PackageReadmeFile>readme.md</PackageReadmeFile>
<RootNamespace>QuanTAlib</RootNamespace> <RootNamespace>QuanTAlib</RootNamespace>
<AssemblyName>QuanTAlib</AssemblyName> <AssemblyName>QuanTAlib</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<IsPublishable>True</IsPublishable> <IsPublishable>True</IsPublishable>
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
+1
View File
@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<AssemblyName>Averages</AssemblyName> <AssemblyName>Averages</AssemblyName>
<AlgoType>Indicator</AlgoType> <AlgoType>Indicator</AlgoType>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<OutputPath>bin\$(Configuration)\</OutputPath> <OutputPath>bin\$(Configuration)\</OutputPath>
<IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild> <IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild>
<UpdateAssemblyInfo>true</UpdateAssemblyInfo> <UpdateAssemblyInfo>true</UpdateAssemblyInfo>
+1
View File
@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<AssemblyName>Statistics</AssemblyName> <AssemblyName>Statistics</AssemblyName>
<AlgoType>Indicator</AlgoType> <AlgoType>Indicator</AlgoType>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<OutputPath>bin\$(Configuration)\</OutputPath> <OutputPath>bin\$(Configuration)\</OutputPath>
<IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild> <IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild>
<UpdateAssemblyInfo>true</UpdateAssemblyInfo> <UpdateAssemblyInfo>true</UpdateAssemblyInfo>
+1
View File
@@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<AssemblyName>Volatility</AssemblyName> <AssemblyName>Volatility</AssemblyName>
<AlgoType>Indicator</AlgoType> <AlgoType>Indicator</AlgoType>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
<OutputPath>bin\$(Configuration)\</OutputPath> <OutputPath>bin\$(Configuration)\</OutputPath>
<IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild> <IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild>
<UpdateAssemblyInfo>true</UpdateAssemblyInfo> <UpdateAssemblyInfo>true</UpdateAssemblyInfo>