Files
QuanTAlib/.github/workflows/main_automation.yml
T
2023-04-02 17:47:14 -07:00

99 lines
3.4 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
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'
dotnet-quality: 'preview'
- name: Install JDK11 for Sonar Scanner
uses: actions/setup-java@v1
with:
java-version: 1.11
- 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=./coveragereport.html
- name: Build Core QuanTAlib 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: DotCover Test XML
run: dotnet dotcover test ./Tests/Tests.csproj --verbosity minimal --dcReportType=DetailedXML --dcoutput=./coveragereport.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coveragereport.xml
verbose: true
- 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: Codacy coverage reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ./coveragereport.xml
- name: Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: latest
prerelease: true
title: "Latest Build"
files: |
.\Calculations\bin\Release\net6.0\QuanTAlib.dll
.\Indicators\bin\Release\QuanTAlib_Indicators.dll
.\Strategies\bin\Release\QuanTAlib_Strategies.dll
- name: Push package to myget.org
run: dotnet nuget push '.\Calculations\bin\Release\QuanTAlib.*.nupkg'
--api-key ${{ secrets.MYGET_DEPLOY_KEY_QUANTALIB }}
--source https://www.myget.org/F/quantalib/api/v2/package
--skip-duplicate
- name: Push package to nuget.org
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push '.\Calculations\bin\Release\QuanTAlib.*.nupkg'
--api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate