diff --git a/.github/workflows/wf-build-release-ci.yml b/.github/workflows/wf-build-release-ci.yml new file mode 100644 index 00000000..ada377ce --- /dev/null +++ b/.github/workflows/wf-build-release-ci.yml @@ -0,0 +1,112 @@ +name: Build, test, pack, push (CI) +on: + + push: + branches: + - master + pull_request: + branches: + - master + workflow_dispatch: +jobs: + build: + runs-on: windows-latest + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + steps: + - uses: actions/checkout@v1 + name: Checkout Code + + - name: Setup MSBuild Ppth + uses: microsoft/setup-msbuild@v1 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.2 + + - name: Restore NuGet Packages + run: nuget restore QRCoder.sln + + - name: Build library + run: msbuild QRCoder.sln /p:Configuration=Release /nr:false /t:Rebuild + + - name: Upload artifacts + uses: actions/upload-artifact@v1.0.0 + with: + name: Compiled project + path: D:\a\qrcoder\qrcoder + + test: + needs: build + runs-on: windows-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v1.0.0 + with: + name: Compiled project + path: D:\a\qrcoder\qrcoder + - name: Run test .NET 3.5 + run: dotnet test -c Release -f net35 --nologo --no-build # No coverage for NET3.5 because of bug in combination with Coverlet+Stron naming + - name: Run test .NET 4.52 + run: dotnet test -c Release -f net452 --nologo --no-build # No coverage for NET4.5 because of bug in combination with Coverlet+Stron naming +# Skip 1.1 test due to missing support on Github runner +# - name: Run test .NET Core 1.1 +# run: dotnet test -c Release -f netcoreapp1.1 --nologo + - name: Run test .NET Core 2.0 + run: dotnet test -c Release -f netcoreapp2.0 --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - name: Run test .NET 5.0 + run: dotnet test -c Release -f net5.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - name: Run test .NET 5.0 Windows + run: dotnet test -c Release -f net5.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - name: Codecov update netcoreapp2.0 + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./QRCoderTests/coverage.netcoreapp2.0.opencover.xml + flags: netcoreapp2.0 + - name: Codecov update net5.0 + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./QRCoderTests/coverage.net5.0.opencover.xml + flags: net5.0 + - name: Codecov update net5.0-windows + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml + flags: net5.0-windows + + pack-push-ci: + needs: test + runs-on: windows-latest + env: + GH_PKG_SEC: ${{ secrets.GH_PKG_REPO }} + steps: + - name: Download artifacts + uses: actions/download-artifact@v1.0.0 + with: + name: Compiled project + path: D:\a\qrcoder\qrcoder + - name: Restore dependencies + run: dotnet restore + - name: Get assembly version + 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 + 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 + run: echo "CI_TAG=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + - name: Build 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: Publish 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@v1.0.0 + with: + name: Compiled project diff --git a/.github/workflows/wf-build-release.yml b/.github/workflows/wf-build-release.yml new file mode 100644 index 00000000..d16e603b --- /dev/null +++ b/.github/workflows/wf-build-release.yml @@ -0,0 +1,107 @@ +name: Build, test, pack, push (Release) +on: + workflow_dispatch: + inputs: + releaseNotes: + description: 'Release Notes (use `n for new line)' + required: true +jobs: + build: + runs-on: windows-latest + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + steps: + - uses: actions/checkout@v1 + name: Checkout Code + + - name: Setup MSBuild Ppth + uses: microsoft/setup-msbuild@v1 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.2 + + - name: Restore NuGet Packages + run: nuget restore QRCoder.sln + + - name: Build library + run: msbuild QRCoder.sln /p:Configuration=Release /nr:false /t:Rebuild + + - name: Upload artifacts + uses: actions/upload-artifact@v1.0.0 + with: + name: Compiled project + path: D:\a\qrcoder\qrcoder + + test: + needs: build + runs-on: windows-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v1.0.0 + with: + name: Compiled project + path: D:\a\qrcoder\qrcoder + - name: Run test .NET 3.5 + run: dotnet test -c Release -f net35 --nologo --no-build # No coverage for NET3.5 because of bug in combination with Coverlet+Stron naming + - name: Run test .NET 4.52 + run: dotnet test -c Release -f net452 --nologo --no-build # No coverage for NET4.5 because of bug in combination with Coverlet+Stron naming +# Skip 1.1 test due to missing support on Github runner +# - name: Run test .NET Core 1.1 +# run: dotnet test -c Release -f netcoreapp1.1 --nologo + - name: Run test .NET Core 2.0 + run: dotnet test -c Release -f netcoreapp2.0 --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - name: Run test .NET 5.0 + run: dotnet test -c Release -f net5.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - name: Run test .NET 5.0 Windows + run: dotnet test -c Release -f net5.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + - name: Codecov update netcoreapp2.0 + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./QRCoderTests/coverage.netcoreapp2.0.opencover.xml + flags: netcoreapp2.0 + - name: Codecov update net5.0 + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./QRCoderTests/coverage.net5.0.opencover.xml + flags: net5.0 + - name: Codecov update net5.0-windows + uses: codecov/codecov-action@v2 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml + flags: net5.0-windows + + pack-push-release: + needs: test + runs-on: windows-latest + env: + GH_PKG_SEC: ${{ secrets.GH_PKG_REPO }} + steps: + - name: Download artifacts + uses: actions/download-artifact@v1.0.0 + with: + name: Compiled project + path: D:\a\qrcoder\qrcoder + - name: Restore dependencies + run: dotnet restore + - name: Get assembly version + 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 + 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: Build NuGet package + run: dotnet pack QRCoder\QRCoder.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT" /p:PackageReleaseNotes="${{ github.event.inputs.releaseNotes }}" + - name: Publish 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-release] + if: always() + runs-on: windows-latest + steps: + - name: Delete artifacts + uses: GeekyEggo/delete-artifact@v1.0.0 + with: + name: Compiled project diff --git a/MyGet.bat b/MyGet.bat deleted file mode 100644 index 8e0b0783..00000000 --- a/MyGet.bat +++ /dev/null @@ -1,31 +0,0 @@ -@echo Off -set config=%1 -if "%config%" == "" ( - set config=Release -) - -echo Working dir: %cd% - -dotnet clean -c %config% - -dotnet build -c %config% || EXIT /B 1 - -echo Assembly information - -powershell -Command "[Reflection.Assembly]::ReflectionOnlyLoadFrom(\"%cd%\QRCoder\bin\%config%\net35\QRCoder.dll\").ImageRuntimeVersion" -certUtil -hashfile "QRCoder\bin\%config%\net35\QRCoder.dll" md5 - -powershell -Command "[Reflection.Assembly]::ReflectionOnlyLoadFrom(\"%cd%\QRCoder\bin\%config%\net40\QRCoder.dll\").ImageRuntimeVersion" -certUtil -hashfile "QRCoder\bin\%config%\net40\QRCoder.dll" md5 - -powershell -Command "[Reflection.Assembly]::ReflectionOnlyLoadFrom(\"%cd%\QRCoder\bin\%config%\netstandard1.1\QRCoder.dll\").ImageRuntimeVersion" -certUtil -hashfile "QRCoder\bin\%config%\netstandard1.1\QRCoder.dll" md5 - -powershell -Command "[Reflection.Assembly]::ReflectionOnlyLoadFrom(\"%cd%\QRCoder\bin\%config%\netstandard2.0\QRCoder.dll\").ImageRuntimeVersion" -certUtil -hashfile "QRCoder\bin\%config%\netstandard2.0\QRCoder.dll" md5 - -dotnet test QRCoderTests\QRCoderTests.csproj --framework net452 || EXIT /B 1 -dotnet test QRCoderTests\QRCoderTests.csproj --framework netcoreapp1.1 || EXIT /B 1 -dotnet test QRCoderTests\QRCoderTests.csproj --framework netcoreapp2.0 || EXIT /B 1 - -dotnet pack QRCoder\QRCoder.csproj -c %config% --no-build diff --git a/QRCoder/Assets/nuget-icon.png b/QRCoder/Assets/nuget-icon.png new file mode 100644 index 00000000..118fe3a1 Binary files /dev/null and b/QRCoder/Assets/nuget-icon.png differ diff --git a/QRCoder/Assets/nuget-readme.md b/QRCoder/Assets/nuget-readme.md new file mode 100644 index 00000000..25cc22aa --- /dev/null +++ b/QRCoder/Assets/nuget-readme.md @@ -0,0 +1,54 @@ +## About + +QRCoder is a simple library, written in C#.NET, which enables you to create QR codes. It hasn't any dependencies to other libraries and is available as .NET Framework and .NET Core PCL version on NuGet. + +*** + +## Documentation + +👉 *Your first place to go should be our wiki. Here you can find a detailed documentation of the QRCoder and its functions.* +* [**QRCode Wiki**](https://github.com/codebude/QRCoder/wiki) +* [Creator's blog (english)](http://en.code-bude.net/2013/10/17/qrcoder-an-open-source-qr-code-generator-implementation-in-csharp/) +* [Creator's blog (german)](http://code-bude.net/2013/10/17/qrcoder-eine-open-source-qr-code-implementierung-in-csharp/) + + +## Usage / Quick start + +You only need five lines of code, to generate and view your first QR code. + +```csharp +QRCodeGenerator qrGenerator = new QRCodeGenerator(); +QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q); +QRCode qrCode = new QRCode(qrCodeData); +Bitmap qrCodeImage = qrCode.GetGraphic(20); +``` + +### Optional parameters and overloads + +The GetGraphics-method has some more overloads. The first two enable you to set the color of the QR code graphic. One uses Color-class-types, the other HTML hex color notation. + +```csharp +//Set color by using Color-class types +Bitmap qrCodeImage = qrCode.GetGraphic(20, Color.DarkRed, Color.PaleGreen, true); + +//Set color by using HTML hex color notation +Bitmap qrCodeImage = qrCode.GetGraphic(20, "#000ff0", "#0ff000"); +``` + +The other overload enables you to render a logo/image in the center of the QR code. + +```csharp +Bitmap qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, (Bitmap)Bitmap.FromFile("C:\\myimage.png")); +``` + +There are a plenty of other options. So feel free to read more on that in our wiki: [Wiki: How to use QRCoder](https://github.com/codebude/QRCoder/wiki/How-to-use-QRCoder) + +## Help & Issues + +If you think you have a bug or have new ideas/feature requests, then feel free to open a new issues: https://github.com/codebude/QRCoder/issues +In case you have a question about using the library (and couldn't find an answer in our wiki), feel free to open a new question/discussion: https://github.com/codebude/QRCoder/discussions + + +## Legal information and credits + +QRCoder is a project by [Raffael Herrmann](https://raffaelherrmann.de) and was first released in 10/2013. It's licensed under the [MIT license](https://github.com/codebude/QRCoder/blob/master/LICENSE.txt). \ No newline at end of file diff --git a/QRCoder/QRCoder.csproj b/QRCoder/QRCoder.csproj index 89dbc33a..ec6c4618 100644 --- a/QRCoder/QRCoder.csproj +++ b/QRCoder/QRCoder.csproj @@ -7,6 +7,7 @@ true $(DefineConstants);NET5_0_WINDOWS false + true @@ -16,22 +17,31 @@ false QRCoder - 1.4.1 + 1.4.2 Raffael Herrmann + Raffael Herrmann QRCoder MIT https://github.com/codebude/QRCoder/ - http://code-bude.net/downloads/qrcoder-logo.png + nuget-icon.png + nuget-readme.md c# csharp qr qrcoder qrcode qr-generator qr-code-generator https://github.com/codebude/QRCoder.git + git + QRCoder is a simple library, written in C#.NET, which enables you to create QR codes. + + + + + - + @@ -39,6 +49,9 @@ $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client false + true + QRCoderStrongName.snk + false - - \ No newline at end of file + + diff --git a/QRCoder/QRCoderStrongName.snk b/QRCoder/QRCoderStrongName.snk new file mode 100644 index 00000000..b65030e1 Binary files /dev/null and b/QRCoder/QRCoderStrongName.snk differ diff --git a/QRCoderTests/QRCoderTests.csproj b/QRCoderTests/QRCoderTests.csproj index f83a5cab..b14a2471 100644 --- a/QRCoderTests/QRCoderTests.csproj +++ b/QRCoderTests/QRCoderTests.csproj @@ -7,6 +7,7 @@ false true false + true @@ -27,6 +28,14 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -41,4 +50,4 @@ $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client false - \ No newline at end of file + diff --git a/readme.md b/readme.md index 8899f4c6..6f75c4b4 100644 --- a/readme.md +++ b/readme.md @@ -1,6 +1,12 @@ # QRCoder -[![qrcoder MyGet Build Status](https://www.myget.org/BuildSource/Badge/qrcoder?identifier=10cbdaa5-2dd9-460b-b424-be44e75258ec&service=github)](https://www.myget.org/feed/qrcoder/package/nuget/QRCoder) [![NuGet Badge](https://buildstats.info/nuget/QRCoder)](https://www.nuget.org/packages/QRCoder/) -## Info + +|Build|Code coverage|Build status|NuGet Package| +|-----|-------------|------------|-------------| +|Latest / Stable|[![codecov](https://codecov.io/gh/codebude/QRCoder/branch/master/graph/badge.svg?token=3yNs88KD8S)](https://codecov.io/gh/codebude/QRCoder)|[![Build, test, pack, push (Release)](https://github.com/codebude/QRCoder/actions/workflows/wf-build-release.yml/badge.svg?branch=main)](https://github.com/codebude/QRCoder/actions/workflows/wf-build-release.yml)|[![NuGet Badge](https://buildstats.info/nuget/QRCoder)](https://www.nuget.org/packages/QRCoder/)| +|CI / Last commit|[![codecov](https://codecov.io/gh/codebude/QRCoder/branch/master/graph/badge.svg?token=3yNs88KD8S)](https://codecov.io/gh/codebude/QRCoder)|[![Build, test, pack, push (CI)](https://github.com/codebude/QRCoder/actions/workflows/wf-build-release-ci.yml/badge.svg)](https://github.com/codebude/QRCoder/actions/workflows/wf-build-release-ci.yml)|[![Github packages](https://img.shields.io/badge/Github-Packages-blue)](https://github.com/codebude/qrcoder/packages)| + + +## Info QRCoder is a simple library, written in C#.NET, which enables you to create QR codes. It hasn't any dependencies to other libraries and is available as .NET Framework and .NET Core PCL version on NuGet. @@ -8,12 +14,11 @@ Feel free to grab-up/fork the project and make it better! For more information see: [**QRCode Wiki**](https://github.com/codebude/QRCoder/wiki) | [Creator's blog (english)](http://en.code-bude.net/2013/10/17/qrcoder-an-open-source-qr-code-generator-implementation-in-csharp/) | [Creator's blog (german)](http://code-bude.net/2013/10/17/qrcoder-eine-open-source-qr-code-implementierung-in-csharp/) - + ## Legal information and credits -QRCoder is project by [Raffael Herrmann](http://raffaelherrmann.de) and was first released -in 10/2013. It's licensed under the MIT license. +QRCoder is a project by [Raffael Herrmann](https://raffaelherrmann.de) and was first released in 10/2013. It's licensed under the [MIT license](https://github.com/codebude/QRCoder/blob/master/LICENSE.txt). * * * @@ -26,12 +31,9 @@ Either checkout this Github repository or install QRCoder via NuGet Package Mana PM> Install-Package QRCoder ``` -*Note: The NuGet feed contains only **stable** releases. If you wan't the latest build add one of the following urls to the "Package Sources" of Visual Studio's NuGet Package Manager options.* - -*NuGet V3 feed URL (Visual Studio 2015+):* `https://www.myget.org/F/qrcoder/api/v3/index.json` - -*NuGet V2 feed URL (Visual Studio 2012+):* `https://www.myget.org/F/qrcoder/api/v2` - +#### CI builds +The NuGet feed contains only **major/stable** releases. If you want the latest functions and features, you can use the CI builds [via Github packages](https://github.com/codebude/qrcoder/packages). +_(More information on how to use Github Packages in Nuget Package Manager can be [found here](http://webcache.googleusercontent.com/search?q=cache:i_gL6oIwpr8J:www.catiawidgets.net/2021/04/20/creating-github-packages-and-accessing-them-in-nuget/+&cd=1&hl=de&ct=clnk&gl=de).)_ ## Usage