Skip to content

Commit 1cfb71e

Browse files
committed
Added Github-Actions for build, removed MyGet
Removes MyGet build script and introduces Github Actions as new "build engine".
1 parent 4d33df0 commit 1cfb71e

File tree

5 files changed

+232
-32
lines changed

5 files changed

+232
-32
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/QRCoder.csproj

Lines changed: 3 additions & 0 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'">
@@ -52,3 +53,5 @@
5253
<AssemblyOriginatorKeyFile>QRCoderStrongName.snk</AssemblyOriginatorKeyFile>
5354
<DelaySign>false</DelaySign>
5455
</PropertyGroup>
56+
57+
</Project>

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)