Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
183 changes: 52 additions & 131 deletions .github/workflows/wf-build-release-ci.yml
Original file line number Diff line number Diff line change
@@ -1,167 +1,99 @@
name: Build, test, pack, push (CI)

on:
push:
branches:
- master
- master
workflow_dispatch:
jobs:
build:
runs-on: windows-latest

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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: |
1.0.x
2.0.x
dotnet-version: |
2.1.x
3.1.x
5.0.x
6.0.x
8.0.x

- name: Restore NuGet Packages
run: dotnet restore

- name: Build library
run: dotnet build -c Release --no-restore
- name: Run tests
working-directory: QRCoderTests
run: dotnet test -c Debug --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Upload artifacts
- name: Upload coverage files
uses: actions/upload-artifact@v4
with:
name: Compiled project
path: ${{ github.workspace }}
name: coverage-files
path: QRCoderTests/coverage.*.xml
retention-days: 1

test:
needs: build
runs-on: windows-latest
steps:
- name: Download artifacts
upload-coverage:
needs: test
runs-on: ubuntu-latest
steps:
- name: Download coverage files
uses: actions/download-artifact@v4
with:
name: Compiled project
path: ${{ github.workspace }}

- name: Install additional .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
2.0.x
5.0.x
6.0.x
8.0.x

- name: Run test .NET 3.5
working-directory: QRCoderTests
run: dotnet test -c Release -f net35 --nologo --no-build # No coverage for NET3.5 because of bug in combination with Coverlet+Stronh naming

- name: Run test .NET 4.52
working-directory: QRCoderTests
run: dotnet test -c Release -f net452 --nologo --no-build # No coverage for NET4.5 because of bug in combination with Coverlet+Strong naming

- name: Run test .NET Core 1.1
working-directory: QRCoderTests
run: dotnet test -c Release -f netcoreapp1.1 --nologo # No coverage for .NETCORE 1.1 because Coverlet doesn't support it https://github.com/coverlet-coverage/coverlet/issues/466

- name: Run test .NET Core 2.0
working-directory: QRCoderTests
run: dotnet test -c Release -f netcoreapp2.0 --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Run test .NET 5.0
working-directory: QRCoderTests
run: dotnet test -c Release -f net5.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Run test .NET 5.0 Windows
working-directory: QRCoderTests
run: dotnet test -c Release -f net5.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Run test .NET 6.0
working-directory: QRCoderTests
run: dotnet test -c Release -f net6.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Run test .NET 6.0 Windows
working-directory: QRCoderTests
run: dotnet test -c Release -f net6.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover

- name: Run API approval tests
working-directory: QRCoderApiTests
run: dotnet test -c Release --nologo --no-build

- name: Codecov update netcoreapp2.0
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
fail_ci_if_error: true
files: ./QRCoderTests/coverage.netcoreapp2.0.opencover.xml
flags: netcoreapp2.0
name: coverage-files

- name: Codecov update net5.0
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
fail_ci_if_error: true
files: ./QRCoderTests/coverage.net5.0.opencover.xml
flags: net5.0

- name: Codecov update net5.0-windows
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
fail_ci_if_error: true
files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml
flags: net5.0-windows
additional-tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
name: Checkout Code

- name: Codecov update net6.0
uses: codecov/codecov-action@v4
- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
fail_ci_if_error: true
files: ./QRCoderTests/coverage.net5.0.opencover.xml
flags: net6.0
dotnet-version: 8.0.x

- name: Codecov update net6.0-windows
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
fail_ci_if_error: true
files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml
flags: net6.0-windows
- 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
needs: [test, additional-tests, upload-coverage]
runs-on: windows-latest
env:
GH_PKG_SEC: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: Compiled project
path: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
name: Checkout Code

- name: Install additional .NET SDKs
- name: Install .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
1.0.x
2.0.x
5.0.x
6.0.x
8.0.x
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

Expand All @@ -187,15 +119,4 @@ jobs:
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


clean:
needs: [build, test, pack-push-ci]
if: always()
runs-on: windows-latest
steps:
- name: Delete artifacts
uses: GeekyEggo/delete-artifact@v5
with:
name: Compiled project
run: dotnet nuget push "**/*.nupkg" --no-symbols --skip-duplicate --api-key $env:GH_PKG_SEC --source https://nuget.pkg.github.com/Shane32/index.json
8 changes: 7 additions & 1 deletion .github/workflows/wf-build-test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: Build, test (Pull Request)

on:
pull_request:
branches:
- master
workflow_dispatch:

concurrency:
group: pr-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build:
runs-on: windows-latest
Expand Down Expand Up @@ -34,6 +39,7 @@ jobs:
needs: build
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
dotnet-framework:
- { name: ".NET Framework 4.6.2", framework: "net462", coverage: false, no-build: true, sdk: "8.0.x" }
Expand Down
2 changes: 1 addition & 1 deletion QRCoder.Xaml/QRCoder.Xaml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<ProjectReference Include="..\QRCoder\QRCoder.csproj" />
</ItemGroup>

<PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>QRCoder.XamlStrongName.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
Expand Down
2 changes: 1 addition & 1 deletion QRCoder/QRCoder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>

<PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>QRCoderStrongName.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
Expand Down