Cassandra storage #53
Workflow file for this run
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: Build | |
on: | |
push: | |
branches: [ "master" ] | |
paths: | |
- 'src/**' | |
pull_request: | |
branches: [ "master" ] | |
paths: | |
- 'src/**' | |
workflow_dispatch: | |
permissions: | |
checks: write | |
pull-requests: write | |
jobs: | |
build: | |
name: Build, Test, Package, and Publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: 'zulu' # Alternative distribution options are available. | |
- name: Cache SonarCloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~\sonar\cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Cache SonarCloud scanner | |
id: cache-sonar-scanner | |
uses: actions/cache@v4 | |
with: | |
path: sonar\scanner | |
key: ${{ runner.os }}-sonar-scanner | |
restore-keys: ${{ runner.os }}-sonar-scanner | |
- name: Install SonarCloud scanner | |
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p sonar/scanner | |
dotnet tool update dotnet-sonarscanner --tool-path sonar/scanner | |
- name: Install dotnet-coverage | |
run: | | |
mkdir -p dotnet/coverage | |
dotnet tool install dotnet-coverage --tool-path dotnet/coverage | |
- name: Restore dependencies | |
run: dotnet restore src | |
- name: Build and Test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar/scanner/dotnet-sonarscanner begin \ | |
/k:"kostiantyn-matsebora_streamstore" /o:"kostiantyn-matsebora" \ | |
/d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" \ | |
/d:sonar.scanner.scanAll=false /d:sonar.inclusions="src/**" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml \ | |
/d:sonar.cs.vstest.reportsPaths=**/*.trx | |
dotnet build src -c Release --no-restore | |
dotnet/coverage/dotnet-coverage collect \ | |
'dotnet test src -c Release --no-build --verbosity normal --logger:trx --results-directory output/test-results --filter FullyQualifiedName/!~IntegrationTests' \ | |
-f xml -o 'coverage.xml' | |
sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action/linux@v2 | |
if: always() | |
with: | |
files: | | |
output/test-results/*.trx | |
- name: Package | |
run: dotnet pack src -c Release --output output/artifacts | |
if: success() | |
- name: Publish | |
if: success() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' | |
working-directory: output/artifacts | |
run: dotnet nuget push *.nupkg --source "https://api.nuget.org/v3/index.json" --api-key "${{ secrets.NUGET_APIKEY }}" --skip-duplicate |