docs: Add ADR custom indicator (example) #549
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Indicators | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["*"] | |
workflow_dispatch: | |
jobs: | |
test: | |
name: unit tests | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: read | |
actions: read | |
checks: write | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
dotnet-version: ["6.0.x", "9.0.x"] | |
env: | |
# identifying primary configuration so only one reports coverage | |
IS_PRIMARY: ${{ matrix.os == 'ubuntu-latest' && matrix.dotnet-version == '9.0.x' }} | |
# Identifies the current target framework | |
TARGET_FRAMEWORK: > | |
${{ matrix.dotnet-version == '6.0.x' && 'net6.0' || | |
matrix.dotnet-version == '9.0.x' && 'net9.0' }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "9.x" | |
dotnet-quality: "ga" | |
- name: Build library | |
run: > | |
dotnet build | |
--configuration Release | |
--property:ContinuousIntegrationBuild=true | |
-warnAsError | |
- name: Test indicators | |
env: | |
ALPACA_KEY: ${{ secrets.ALPACA_KEY }} | |
ALPACA_SECRET: ${{ secrets.ALPACA_SECRET }} | |
run: > | |
dotnet test tests/indicators/Tests.Indicators.csproj | |
--configuration Release | |
--property:TestFramework="${{ env.TARGET_FRAMEWORK }}" | |
--no-build | |
--verbosity normal | |
--logger trx | |
--collect:"XPlat Code Coverage" | |
--results-directory ./test-indicators | |
# the remaining steps are only needed from one primary instance | |
- name: Test other items | |
if: env.IS_PRIMARY == 'true' | |
run: > | |
dotnet test tests/other/Tests.Other.csproj | |
--configuration Release | |
--no-build | |
--verbosity normal | |
--logger trx | |
--results-directory ./test-other | |
- name: Post test results | |
uses: dorny/test-reporter@v1.9.1 | |
if: env.IS_PRIMARY == 'true' && always() | |
with: | |
name: Test results | |
path: ./test-indicators/**/*.trx | |
reporter: dotnet-trx | |
- name: Publish coverage to Codacy | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
if: env.IS_PRIMARY == 'true' | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: ./test-indicators/**/coverage.cobertura.xml |