Skip to content

docs: Refactor doc site test frameworks #541

docs: Refactor doc site test frameworks

docs: Refactor doc site test frameworks #541

Workflow file for this run

name: CI
# This is the primary CI workflow, sequenced to use
# a fail-fast approach in multiple stages.
on:
push:
branches:
- "main"
- "v[0-9]*"
pull_request:
branches: ["*"]
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
permissions:
contents: read # Required for checkout
checks: write # Required for test results
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
quick-check:
name: quick check
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.x"
dotnet-quality: "ga"
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Install .NET tools
run: dotnet tool restore
- name: Build core project
# note: Roslynator cannot use cached bin/obj
run: >
dotnet build src/Indicators.csproj
--configuration Release
--property:ContinuousIntegrationBuild=true
-warnAsError
- name: Run Roslynator analysis
# note: this is faster than format check
run: >
dotnet tool run roslynator analyze src/Indicators.csproj
--properties TargetFramework=net10.0
--severity-level hidden
--verbosity normal
- name: Lint markdown
run: echo y | npx markdownlint-cli2
- name: Audit StreamHub tests
run: bash tools/scripts/audit-streamhub.sh
- name: Build (package tests)
run: >
dotnet build tests/Library/Tests.Indicators.csproj
--configuration Release
--property:ContinuousIntegrationBuild=true
-warnAsError
lint-and-test:
runs-on: ubuntu-latest
needs: quick-check
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout source
uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.x"
dotnet-quality: "ga"
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Test indicators
run: >
dotnet test tests/Library/Tests.Indicators.csproj
--configuration Release
--settings tests/tests.unit.runsettings
--results-directory ./test-results/unit
--verbosity normal
--logger trx
--collect:"XPlat Code Coverage"
- name: Post unit test results
uses: dorny/test-reporter@v2.3.0
if: ${{ !cancelled() }}
with:
name: Unit test results
path: test-results/unit/**/*.trx
reporter: dotnet-trx
list-tests: failed
continue-on-error: true
- name: Upload coverage reports
uses: actions/upload-artifact@v7
if: ${{ !cancelled() }}
with:
name: coverage-unit
path: test-results/unit/**/coverage.cobertura.xml
retention-days: 1
continue-on-error: true
- name: Publish coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@v1.3.0
if: success() && github.actor != 'dependabot[bot]'
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: test-results/unit/**/coverage.cobertura.xml
continue-on-error: true
lint-full:
name: linting (full)
runs-on: ubuntu-latest
needs: ["lint-and-test", "test-regression"]
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout source
uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.x"
dotnet-quality: "ga"
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Install .NET tools
run: dotnet tool restore
- name: Build solution
# note: Roslynator cannot use cached bin/obj
run: >
dotnet build
--configuration Release
--property:ContinuousIntegrationBuild=true
- name: Run Roslynator analysis
run: >
dotnet tool run roslynator analyze
--properties TargetFramework=net10.0
--severity-level hidden
--verbosity normal
- name: Check .NET code formatting
run: dotnet format --verify-no-changes --severity info --no-restore
test-regression:
name: regression tests
runs-on: ubuntu-latest
needs: quick-check
if: ${{ !github.event.pull_request.draft }}
steps:
- name: Checkout source
uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.x"
dotnet-quality: "ga"
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Test regression baselines
run: >
dotnet test tests/Library/Tests.Indicators.csproj
--configuration Release
--settings tests/tests.regression.runsettings
--results-directory ./test-results/regression
--verbosity normal
--logger trx
- name: Post regression test results
uses: dorny/test-reporter@v2.3.0
if: ${{ !cancelled() }}
with:
name: Regression test results
path: test-results/regression/**/*.trx
reporter: dotnet-trx
list-tests: failed
continue-on-error: true