Skip to content

Commit 8c457d6

Browse files
authored
GitHub workflow (#5)
* Github Actions
1 parent d2bdbf6 commit 8c457d6

4 files changed

Lines changed: 108 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- github-workflow
8+
jobs:
9+
Build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout latest
14+
uses: actions/checkout@v2
15+
16+
- name: Setup .NET Core
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 8.*
20+
21+
- name: Install dependencies
22+
run: dotnet restore
23+
24+
- name: Build
25+
run: dotnet build --configuration Release --no-restore
26+
27+
- name: Upload Artificats
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: TestBinaries
31+
path: HttpTwo.Tests/**/bin/*
32+
33+
UnitTest:
34+
name: Run Unit Tests
35+
needs: Build
36+
runs-on: windows-latest
37+
steps:
38+
- name: Checkout latest
39+
uses: actions/checkout@v2
40+
41+
- name: Use Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: "20.x"
45+
46+
- name: Setup .NET Core
47+
uses: actions/setup-dotnet@v1
48+
with:
49+
dotnet-version: 6.*
50+
51+
- uses: actions/download-artifact@v4
52+
with:
53+
name: TestBinaries
54+
path: HttpTwo.Tests
55+
56+
- name: Install dependencies
57+
working-directory: ./HttpTwo.Tests/node-http2
58+
run: npm install
59+
60+
- name: Unit Test (.NET 6.0)
61+
if: ${{ !cancelled() }}
62+
run: dotnet test --verbosity normal --logger "trx;LogFileName=net6.trx" --results-directory coverage bin/Release/net6.0/HttpTwo.Tests.dll
63+
working-directory: ./HttpTwo.Tests
64+
65+
- name: Unit Test (.NET Framework 4.6.2)
66+
if: ${{ !cancelled() }}
67+
run: dotnet test --verbosity normal --logger "trx;LogFileName=net462.trx" --results-directory coverage bin/Release/net462/HttpTwo.Tests.dll
68+
working-directory: ./HttpTwo.Tests
69+
70+
- uses: dorny/test-reporter@v1
71+
if: success() || failure() # run this step even if previous step failed
72+
with:
73+
name: Test Result
74+
path: HttpTwo.Tests/coverage/*.trx
75+
reporter: dotnet-trx

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release to NuGet
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 5
11+
steps:
12+
- name: Checkout latest
13+
uses: actions/checkout@v2
14+
15+
- name: Setup .NET
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 8.*
19+
20+
- name: Version Output
21+
run: echo ${{ github.event.release.tag_name }} # Output: 1.1.2
22+
23+
- name: Build
24+
run: dotnet build --configuration Release
25+
26+
- name: Generate package
27+
run: dotnet pack --no-build -c Release -o out /p:Version=${{ github.event.release.tag_name }}
28+
29+
- name: Publish
30+
run: dotnet nuget push ./out/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate
31+

HttpTwo.Tests/HttpTwo.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<ItemGroup>
3131
<Reference Include="System" />
3232
<PackageReference Include="NUnit" Version="3.13.3" />
33-
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
33+
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
3434
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
3535
<PackageReference Include="Npm" Version="3.5.2" />
3636
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />

HttpTwo/HttpTwo.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<RootNamespace>HttpTwo</RootNamespace>
99
<AssemblyName>HttpTwo</AssemblyName>
1010
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
11+
<PackageId>HttpTwo.Net</PackageId>
1112
</PropertyGroup>
1213
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1314
<DebugSymbols>true</DebugSymbols>

0 commit comments

Comments
 (0)