Skip to content

Commit

Permalink
Merge pull request #331 from codebude/feature/new-build-process-and-s…
Browse files Browse the repository at this point in the history
…cripts

Feature/new build process and scripts
  • Loading branch information
codebude authored Oct 31, 2021
2 parents d907ed1 + acea6c0 commit e209962
Show file tree
Hide file tree
Showing 9 changed files with 314 additions and 48 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/wf-build-release-ci.yml
Original file line number Diff line number Diff line change
@@ -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
107 changes: 107 additions & 0 deletions .github/workflows/wf-build-release.yml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 0 additions & 31 deletions MyGet.bat

This file was deleted.

Binary file added QRCoder/Assets/nuget-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions QRCoder/Assets/nuget-readme.md
Original file line number Diff line number Diff line change
@@ -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).
23 changes: 18 additions & 5 deletions QRCoder/QRCoder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<UseWPF Condition="'$(TargetFramework)' == 'net5.0-windows'">true</UseWPF>
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0-windows'">$(DefineConstants);NET5_0_WINDOWS</DefineConstants>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand All @@ -16,29 +17,41 @@
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<PackageId>QRCoder</PackageId>
<Version>1.4.1</Version>
<Version>1.4.2</Version>
<Authors>Raffael Herrmann</Authors>
<PackageOwners>Raffael Herrmann</PackageOwners>
<AssemblyName>QRCoder</AssemblyName>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/codebude/QRCoder/</PackageProjectUrl>
<PackageIconUrl>http://code-bude.net/downloads/qrcoder-logo.png</PackageIconUrl>
<PackageIcon>nuget-icon.png</PackageIcon>
<PackageReadmeFile>nuget-readme.md</PackageReadmeFile>
<PackageTags>c# csharp qr qrcoder qrcode qr-generator qr-code-generator</PackageTags>
<RepositoryUrl>https://github.com/codebude/QRCoder.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>QRCoder is a simple library, written in C#.NET, which enables you to create QR codes.</Description>
</PropertyGroup>

<ItemGroup>
<None Include="Assets\nuget-icon.png" Pack="true" PackagePath="\" />
<None Include="Assets\nuget-readme.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net35' or '$(TargetFramework)' == 'net40' ">
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
</ItemGroup>

<PropertyGroup>
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
<AutomaticallyUseReferenceAssemblyPackages Condition=" '$(TargetFramework)' == 'net35' ">false</AutomaticallyUseReferenceAssemblyPackages>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>QRCoderStrongName.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
</PropertyGroup>
</Project>

</Project>
Binary file added QRCoder/QRCoderStrongName.snk
Binary file not shown.
11 changes: 10 additions & 1 deletion QRCoderTests/QRCoderTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net5.0-windows' ">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
Expand All @@ -27,6 +28,14 @@
<PackageReference Include="shouldly" Version="3.0.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<ProjectReference Include="..\QRCoder\QRCoder.csproj" />
</ItemGroup>
<ItemGroup>
Expand All @@ -41,4 +50,4 @@
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
<AutomaticallyUseReferenceAssemblyPackages Condition=" '$(TargetFramework)' == 'net35' ">false</AutomaticallyUseReferenceAssemblyPackages>
</PropertyGroup>
</Project>
</Project>
Loading

0 comments on commit e209962

Please sign in to comment.