Skip to content

Commit e209962

Browse files
authored
Merge pull request #331 from codebude/feature/new-build-process-and-scripts
Feature/new build process and scripts
2 parents d907ed1 + acea6c0 commit e209962

File tree

9 files changed

+314
-48
lines changed

9 files changed

+314
-48
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Build, test, pack, push (CI)
2+
on:
3+
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
workflow_dispatch:
11+
jobs:
12+
build:
13+
runs-on: windows-latest
14+
env:
15+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
16+
steps:
17+
- uses: actions/checkout@v1
18+
name: Checkout Code
19+
20+
- name: Setup MSBuild Ppth
21+
uses: microsoft/setup-msbuild@v1
22+
23+
- name: Setup NuGet
24+
uses: NuGet/[email protected]
25+
26+
- name: Restore NuGet Packages
27+
run: nuget restore QRCoder.sln
28+
29+
- name: Build library
30+
run: msbuild QRCoder.sln /p:Configuration=Release /nr:false /t:Rebuild
31+
32+
- name: Upload artifacts
33+
uses: actions/[email protected]
34+
with:
35+
name: Compiled project
36+
path: D:\a\qrcoder\qrcoder
37+
38+
test:
39+
needs: build
40+
runs-on: windows-latest
41+
steps:
42+
- name: Download artifacts
43+
uses: actions/[email protected]
44+
with:
45+
name: Compiled project
46+
path: D:\a\qrcoder\qrcoder
47+
- name: Run test .NET 3.5
48+
run: dotnet test -c Release -f net35 --nologo --no-build # No coverage for NET3.5 because of bug in combination with Coverlet+Stron naming
49+
- name: Run test .NET 4.52
50+
run: dotnet test -c Release -f net452 --nologo --no-build # No coverage for NET4.5 because of bug in combination with Coverlet+Stron naming
51+
# Skip 1.1 test due to missing support on Github runner
52+
# - name: Run test .NET Core 1.1
53+
# run: dotnet test -c Release -f netcoreapp1.1 --nologo
54+
- name: Run test .NET Core 2.0
55+
run: dotnet test -c Release -f netcoreapp2.0 --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
56+
- name: Run test .NET 5.0
57+
run: dotnet test -c Release -f net5.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
58+
- name: Run test .NET 5.0 Windows
59+
run: dotnet test -c Release -f net5.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
60+
- name: Codecov update netcoreapp2.0
61+
uses: codecov/codecov-action@v2
62+
with:
63+
token: ${{ secrets.CODECOV_TOKEN }}
64+
files: ./QRCoderTests/coverage.netcoreapp2.0.opencover.xml
65+
flags: netcoreapp2.0
66+
- name: Codecov update net5.0
67+
uses: codecov/codecov-action@v2
68+
with:
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
files: ./QRCoderTests/coverage.net5.0.opencover.xml
71+
flags: net5.0
72+
- name: Codecov update net5.0-windows
73+
uses: codecov/codecov-action@v2
74+
with:
75+
token: ${{ secrets.CODECOV_TOKEN }}
76+
files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml
77+
flags: net5.0-windows
78+
79+
pack-push-ci:
80+
needs: test
81+
runs-on: windows-latest
82+
env:
83+
GH_PKG_SEC: ${{ secrets.GH_PKG_REPO }}
84+
steps:
85+
- name: Download artifacts
86+
uses: actions/[email protected]
87+
with:
88+
name: Compiled project
89+
path: D:\a\qrcoder\qrcoder
90+
- name: Restore dependencies
91+
run: dotnet restore
92+
- name: Get assembly version
93+
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
94+
- name: Clean assembly version
95+
run: echo "ASSEM_VER_SHT=$($env:ASSEM_VER.substring(0, $env:ASSEM_VER.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
96+
- name: Calculate ci suffix
97+
run: echo "CI_TAG=-ci-$([datetime]::now.tostring("yyyyMMddHHmmss"))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
98+
- name: Build NuGet package
99+
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!"
100+
- name: Publish to Github packages
101+
run: dotnet nuget push "**/*.nupkg" --no-symbols --skip-duplicate --api-key $env:GH_PKG_SEC --source https://nuget.pkg.github.com/codebude/index.json
102+
103+
104+
clean:
105+
needs: [build, test, pack-push-ci]
106+
if: always()
107+
runs-on: windows-latest
108+
steps:
109+
- name: Delete artifacts
110+
uses: GeekyEggo/[email protected]
111+
with:
112+
name: Compiled project
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Build, test, pack, push (Release)
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
releaseNotes:
6+
description: 'Release Notes (use `n for new line)'
7+
required: true
8+
jobs:
9+
build:
10+
runs-on: windows-latest
11+
env:
12+
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
13+
steps:
14+
- uses: actions/checkout@v1
15+
name: Checkout Code
16+
17+
- name: Setup MSBuild Ppth
18+
uses: microsoft/setup-msbuild@v1
19+
20+
- name: Setup NuGet
21+
uses: NuGet/[email protected]
22+
23+
- name: Restore NuGet Packages
24+
run: nuget restore QRCoder.sln
25+
26+
- name: Build library
27+
run: msbuild QRCoder.sln /p:Configuration=Release /nr:false /t:Rebuild
28+
29+
- name: Upload artifacts
30+
uses: actions/[email protected]
31+
with:
32+
name: Compiled project
33+
path: D:\a\qrcoder\qrcoder
34+
35+
test:
36+
needs: build
37+
runs-on: windows-latest
38+
steps:
39+
- name: Download artifacts
40+
uses: actions/[email protected]
41+
with:
42+
name: Compiled project
43+
path: D:\a\qrcoder\qrcoder
44+
- name: Run test .NET 3.5
45+
run: dotnet test -c Release -f net35 --nologo --no-build # No coverage for NET3.5 because of bug in combination with Coverlet+Stron naming
46+
- name: Run test .NET 4.52
47+
run: dotnet test -c Release -f net452 --nologo --no-build # No coverage for NET4.5 because of bug in combination with Coverlet+Stron naming
48+
# Skip 1.1 test due to missing support on Github runner
49+
# - name: Run test .NET Core 1.1
50+
# run: dotnet test -c Release -f netcoreapp1.1 --nologo
51+
- name: Run test .NET Core 2.0
52+
run: dotnet test -c Release -f netcoreapp2.0 --nologo /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
53+
- name: Run test .NET 5.0
54+
run: dotnet test -c Release -f net5.0 --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
55+
- name: Run test .NET 5.0 Windows
56+
run: dotnet test -c Release -f net5.0-windows --nologo --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
57+
- name: Codecov update netcoreapp2.0
58+
uses: codecov/codecov-action@v2
59+
with:
60+
token: ${{ secrets.CODECOV_TOKEN }}
61+
files: ./QRCoderTests/coverage.netcoreapp2.0.opencover.xml
62+
flags: netcoreapp2.0
63+
- name: Codecov update net5.0
64+
uses: codecov/codecov-action@v2
65+
with:
66+
token: ${{ secrets.CODECOV_TOKEN }}
67+
files: ./QRCoderTests/coverage.net5.0.opencover.xml
68+
flags: net5.0
69+
- name: Codecov update net5.0-windows
70+
uses: codecov/codecov-action@v2
71+
with:
72+
token: ${{ secrets.CODECOV_TOKEN }}
73+
files: ./QRCoderTests/coverage.net5.0-windows.opencover.xml
74+
flags: net5.0-windows
75+
76+
pack-push-release:
77+
needs: test
78+
runs-on: windows-latest
79+
env:
80+
GH_PKG_SEC: ${{ secrets.GH_PKG_REPO }}
81+
steps:
82+
- name: Download artifacts
83+
uses: actions/[email protected]
84+
with:
85+
name: Compiled project
86+
path: D:\a\qrcoder\qrcoder
87+
- name: Restore dependencies
88+
run: dotnet restore
89+
- name: Get assembly version
90+
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
91+
- name: Clean assembly version
92+
run: echo "ASSEM_VER_SHT=$($env:ASSEM_VER.substring(0, $env:ASSEM_VER.lastIndexOf(".")))" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
93+
- name: Build NuGet package
94+
run: dotnet pack QRCoder\QRCoder.csproj -c Release --no-build /p:PackageVersion="$env:ASSEM_VER_SHT" /p:PackageReleaseNotes="${{ github.event.inputs.releaseNotes }}"
95+
- name: Publish to Github packages
96+
run: dotnet nuget push "**/*.nupkg" --no-symbols --skip-duplicate --api-key $env:GH_PKG_SEC --source https://nuget.pkg.github.com/codebude/index.json
97+
98+
99+
clean:
100+
needs: [build, test, pack-push-release]
101+
if: always()
102+
runs-on: windows-latest
103+
steps:
104+
- name: Delete artifacts
105+
uses: GeekyEggo/[email protected]
106+
with:
107+
name: Compiled project

MyGet.bat

Lines changed: 0 additions & 31 deletions
This file was deleted.

QRCoder/Assets/nuget-icon.png

22.4 KB
Loading

QRCoder/Assets/nuget-readme.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## About
2+
3+
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.
4+
5+
***
6+
7+
## Documentation
8+
9+
👉 *Your first place to go should be our wiki. Here you can find a detailed documentation of the QRCoder and its functions.*
10+
* [**QRCode Wiki**](https://github.com/codebude/QRCoder/wiki)
11+
* [Creator's blog (english)](http://en.code-bude.net/2013/10/17/qrcoder-an-open-source-qr-code-generator-implementation-in-csharp/)
12+
* [Creator's blog (german)](http://code-bude.net/2013/10/17/qrcoder-eine-open-source-qr-code-implementierung-in-csharp/)
13+
14+
15+
## Usage / Quick start
16+
17+
You only need five lines of code, to generate and view your first QR code.
18+
19+
```csharp
20+
QRCodeGenerator qrGenerator = new QRCodeGenerator();
21+
QRCodeData qrCodeData = qrGenerator.CreateQrCode("The text which should be encoded.", QRCodeGenerator.ECCLevel.Q);
22+
QRCode qrCode = new QRCode(qrCodeData);
23+
Bitmap qrCodeImage = qrCode.GetGraphic(20);
24+
```
25+
26+
### Optional parameters and overloads
27+
28+
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.
29+
30+
```csharp
31+
//Set color by using Color-class types
32+
Bitmap qrCodeImage = qrCode.GetGraphic(20, Color.DarkRed, Color.PaleGreen, true);
33+
34+
//Set color by using HTML hex color notation
35+
Bitmap qrCodeImage = qrCode.GetGraphic(20, "#000ff0", "#0ff000");
36+
```
37+
38+
The other overload enables you to render a logo/image in the center of the QR code.
39+
40+
```csharp
41+
Bitmap qrCodeImage = qrCode.GetGraphic(20, Color.Black, Color.White, (Bitmap)Bitmap.FromFile("C:\\myimage.png"));
42+
```
43+
44+
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)
45+
46+
## Help & Issues
47+
48+
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
49+
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
50+
51+
52+
## Legal information and credits
53+
54+
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).

QRCoder/QRCoder.csproj

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<UseWPF Condition="'$(TargetFramework)' == 'net5.0-windows'">true</UseWPF>
88
<DefineConstants Condition="'$(TargetFramework)' == 'net5.0-windows'">$(DefineConstants);NET5_0_WINDOWS</DefineConstants>
99
<CheckEolTargetFramework>false</CheckEolTargetFramework>
10+
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
1011
</PropertyGroup>
1112

1213
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
@@ -16,29 +17,41 @@
1617
<PropertyGroup>
1718
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
1819
<PackageId>QRCoder</PackageId>
19-
<Version>1.4.1</Version>
20+
<Version>1.4.2</Version>
2021
<Authors>Raffael Herrmann</Authors>
22+
<PackageOwners>Raffael Herrmann</PackageOwners>
2123
<AssemblyName>QRCoder</AssemblyName>
2224
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2325
<PackageProjectUrl>https://github.com/codebude/QRCoder/</PackageProjectUrl>
24-
<PackageIconUrl>http://code-bude.net/downloads/qrcoder-logo.png</PackageIconUrl>
26+
<PackageIcon>nuget-icon.png</PackageIcon>
27+
<PackageReadmeFile>nuget-readme.md</PackageReadmeFile>
2528
<PackageTags>c# csharp qr qrcoder qrcode qr-generator qr-code-generator</PackageTags>
2629
<RepositoryUrl>https://github.com/codebude/QRCoder.git</RepositoryUrl>
30+
<RepositoryType>git</RepositoryType>
31+
<Description>QRCoder is a simple library, written in C#.NET, which enables you to create QR codes.</Description>
2732
</PropertyGroup>
2833

34+
<ItemGroup>
35+
<None Include="Assets\nuget-icon.png" Pack="true" PackagePath="\" />
36+
<None Include="Assets\nuget-readme.md" Pack="true" PackagePath="\" />
37+
</ItemGroup>
38+
2939
<ItemGroup Condition=" '$(TargetFramework)' == 'net35' or '$(TargetFramework)' == 'net40' ">
3040
<Reference Include="PresentationCore" />
3141
<Reference Include="PresentationFramework" />
3242
<Reference Include="WindowsBase" />
3343
</ItemGroup>
34-
44+
3545
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net5.0' ">
3646
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
3747
</ItemGroup>
3848

3949
<PropertyGroup>
4050
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
4151
<AutomaticallyUseReferenceAssemblyPackages Condition=" '$(TargetFramework)' == 'net35' ">false</AutomaticallyUseReferenceAssemblyPackages>
52+
<SignAssembly>true</SignAssembly>
53+
<AssemblyOriginatorKeyFile>QRCoderStrongName.snk</AssemblyOriginatorKeyFile>
54+
<DelaySign>false</DelaySign>
4255
</PropertyGroup>
43-
44-
</Project>
56+
57+
</Project>

QRCoder/QRCoderStrongName.snk

596 Bytes
Binary file not shown.

QRCoderTests/QRCoderTests.csproj

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<IsPackable>false</IsPackable>
88
<IsTestProject>true</IsTestProject>
99
<CheckEolTargetFramework>false</CheckEolTargetFramework>
10+
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
1011
</PropertyGroup>
1112
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net5.0-windows' ">
1213
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
@@ -27,6 +28,14 @@
2728
<PackageReference Include="shouldly" Version="3.0.2" />
2829
</ItemGroup>
2930
<ItemGroup>
31+
<PackageReference Include="coverlet.collector" Version="3.0.3">
32+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
33+
<PrivateAssets>all</PrivateAssets>
34+
</PackageReference>
35+
<PackageReference Include="coverlet.msbuild" Version="3.0.3">
36+
<PrivateAssets>all</PrivateAssets>
37+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
38+
</PackageReference>
3039
<ProjectReference Include="..\QRCoder\QRCoder.csproj" />
3140
</ItemGroup>
3241
<ItemGroup>
@@ -41,4 +50,4 @@
4150
<FrameworkPathOverride Condition="'$(TargetFramework)' == 'net35'">$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>
4251
<AutomaticallyUseReferenceAssemblyPackages Condition=" '$(TargetFramework)' == 'net35' ">false</AutomaticallyUseReferenceAssemblyPackages>
4352
</PropertyGroup>
44-
</Project>
53+
</Project>

0 commit comments

Comments
 (0)