Skip to content

Change test configuration to run in Release mode #120

Change test configuration to run in Release mode

Change test configuration to run in Release mode #120

name: Build, test, pack, push (CI)
on:
push:
branches:
- master
- update-ci-workflow
workflow_dispatch:
jobs:
test:
runs-on: windows-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v4
name: Checkout Code
- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
8.0.x
- name: Run tests
working-directory: QRCoderTests
run: dotnet test -c Release --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
- name: Codecov update
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
fail_ci_if_error: true
files: ./QRCoderTests/coverage.*.opencover.xml
additional-tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
name: Checkout Code
- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Run trim analysis
working-directory: QRCoderTrimAnalysis
run: dotnet publish -c Release -o bin/publish
- name: Run API approval tests
working-directory: QRCoderApiTests
run: dotnet test -c Release --nologo
pack-push-ci:
needs: [test, additional-tests]
runs-on: windows-latest
env:
GH_PKG_SEC: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
name: Checkout Code
- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build library
run: dotnet build -c Release --no-restore
- name: Get assembly version QRCoder
run: echo "ASSEM_VER=$([Reflection.Assembly]::Loadfile( $(-join($pwd,"\QRCoder\bin\Release\net40\QRCoder.dll"))).GetName().version.ToString())" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Clean assembly version QRCoder
run: echo "ASSEM_VER_SHT=$($env:ASSEM_VER.substring(0, $env:ASSEM_VER.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Calculate ci suffix QRCoder
run: echo "CI_TAG=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Get assembly version QRCoder.Xaml
run: echo "ASSEM_VER_XAML=$([Reflection.Assembly]::Loadfile( $(-join($pwd,"\QRCoder.Xaml\bin\Release\net40\QRCoder.Xaml.dll"))).GetName().version.ToString())" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Clean assembly version QRCoder.Xaml
run: echo "ASSEM_VER_SHT_XAML=$($env:ASSEM_VER_XAML.substring(0, $env:ASSEM_VER_XAML.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Calculate ci suffix QRCoder.Xaml
run: echo "CI_TAG_XAML=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Build QRCoder NuGet package
run: dotnet pack QRCoder\QRCoder.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT$env:CI_TAG" /p:PackageReleaseNotes="- This is an automatic CI build ($env:CI_TAG)`n- Please don't use it in productive environments!"
- name: Build QRCoder.Xaml NuGet package
run: dotnet pack QRCoder.Xaml\QRCoder.Xaml.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT_XAML$env:CI_TAG_XAML" /p:PackageReleaseNotes="- This is an automatic CI build ($env:CI_TAG_XAML)`n- Please don't use it in productive environments!"
- name: Publish QRCoder and QRCoder.Xaml to Github packages
run: dotnet nuget push "**/*.nupkg" --no-symbols --skip-duplicate --api-key $env:GH_PKG_SEC --source https://nuget.pkg.github.com/codebude/index.json