Files
QuanTAlib/.github/workflows/main_automation.yml
T

122 lines
4.8 KiB
YAML

name: Stage/build/test/release/publish
on:
workflow_dispatch:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
build_test:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install .NET 6.0 and 8.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-quality: 'preview'
include-prerelease: true
- name: Install JDK11 for Sonar Scanner
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Install GitVersion
run: dotnet tool install GitVersion.Tool --global
- 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: Install CodeCov
run: dotnet tool install --global Codecov.Tool
- 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.vscoveragexml.reportsPaths="./coverage.xml"
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=./coveragereport.html
- name: Build Core DLL
run: dotnet build ./Calculations/Calculations.csproj --verbosity minimal --configuration Release --nologo
- name: Build Indicators DLL
run: dotnet build ./Indicators/Indicators.csproj --verbosity minimal --configuration Release --nologo
- name: Build Strategies DLL
run: dotnet build ./Strategies/Strategies.csproj --verbosity minimal --configuration Release --nologo
- name: dotnet Test
#if: ${{ github.ref == 'refs/heads/dev' }}
run: dotnet test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --configuration Release --nologo
- name: DotCover Test XML
#if: ${{ github.ref == 'refs/heads/dev' }}
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml
- name: DotCover Test HTML
#if: ${{ github.ref == 'refs/heads/dev' }}
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity minimal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html
- name: dotnet-coverage
run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml'
- name: Sonar reporter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
- name: CodeCov run
if: ${{ github.ref == 'refs/heads/dev' }}
run: codecov -f ./coveragereport.xml -v -t ${{ secrets.CODECOV_TOKEN }}
- name: Codacy coverage reporter
if: ${{ github.ref == 'refs/heads/dev' }}
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coveragereport.xml
- name: Release
if: ${{ github.ref == 'refs/heads/main' }}
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Latest Build"
files: |
/Quantower/Settings/Scripts/Indicators/QuanTAlib/*.dll
/Quantower/Settings/Scripts/Strategies/QuanTAlib/*.dll
- name: Authenticate to Github packages Calculations
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget add Calculations
--username mihakralj
--password ${{ secrets.GITHUB_TOKEN }}
--store-password-in-clear-text
--name github "https://nuget.pkg.github.com/mihakralj/index.json"
- name: Push package to github
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push '.\Calculations\bin\Release\QuanTAlib.*.nupkg'
--api-key ${{ secrets.GITHUB_TOKEN }}
--Calculations https://nuget.pkg.github.com/mihakralj/index.json
--skip-duplicate
- name: Push package to nuget.org
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push '.\Calculations\bin\Release\net8.0\QuanTAlib.*.nupkg'
--api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}
--Calculations https://api.nuget.org/v3/index.json
--skip-duplicate