chore: Update dotnetcore.yml workflow to use dotnet version 8.0.x and… #238
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
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: ~/.dotnet/tools/trx2junit **/test-results.trx --output test-results.xml | |
- name: Parse test results | |
id: parse | |
run: | | |
total=$(grep -oP 'tests="\K[0-9]+' test-results.xml) | |
passed=$(grep -oP 'passed="\K[0-9]+' test-results.xml) | |
failed=$(grep -oP 'failed="\K[0-9]+' test-results.xml) | |
skipped=$(grep -oP 'skipped="\K[0-9]+' test-results.xml) | |
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 | |
} |