Skip to content

chore: Update dotnetcore.yml workflow to use dotnet version 8.0.x and… #240

chore: Update dotnetcore.yml workflow to use dotnet version 8.0.x and…

chore: Update dotnetcore.yml workflow to use dotnet version 8.0.x and… #240

Workflow file for this run

name: Publish
on: [push]
jobs:
build:
strategy:
matrix:
runs-on: [windows-latest]
runs-on: ${{ matrix.runs-on }}
name: Running tests on ${{ matrix.runs-on }}.
steps:
- uses: actions/checkout@v4
with:
dotnet-version: '8.0.x'
ref: ${{ github.ref }}
- name: Install trx2junit
run: dotnet tool install -g trx2junit
- name: Build & Run tests
run: dotnet test --configuration Release --logger "trx;LogFileName=test-results.trx"
- name: Convert TRX to JUnit
run: |
$trxFile = Get-ChildItem -Recurse -Filter test-results.trx | Select-Object -First 1
~/.dotnet/tools/trx2junit $trxFile.FullName --output test-results.xml
- name: Parse test results
id: parse
run: |
[xml]$testResults = Get-Content test-results.xml
$total = $testResults.testsuite.tests
$passed = $testResults.testsuite.passed
$failed = $testResults.testsuite.failures
$skipped = $testResults.testsuite.skipped
echo "::set-output name=total::$total"
echo "::set-output name=passed::$passed"
echo "::set-output name=failed::$failed"
echo "::set-output name=skipped::$skipped"
- name: Create badge
run: |
curl -o badge.svg "https://img.shields.io/badge/tests-${{ steps.parse.outputs.total }}%20%2F%20${{ steps.parse.outputs.passed }}-green"
- name: Upload badge
uses: actions/upload-artifact@v2
with:
name: test-badge
path: badge.svg
- name: Publish
if: github.ref == 'refs/heads/master'
run: |
$scriptLocationDirectory=(Get-Location).ToString()
$scriptLocationFilePath=[System.IO.Path]::Combine($scriptLocationDirectory, "Publish.Nuget.ps1")
$nugetExecutable=[System.IO.Path]::Combine($scriptLocationDirectory, "nuget", "nuget.exe")
$projects = @('Musoq.Converter', 'Musoq.Evaluator', 'Musoq.Parser', 'Musoq.Plugins', 'Musoq.Schema')
foreach ($project in $projects) {
pushd
cd "./$project/bin/Release"
Invoke-Expression "$scriptLocationFilePath $nugetExecutable $project '${{ secrets.nuget_musoq_key }}'"
popd
}