Skip to content

Commit 1b4fd53

Browse files
committed
Add Github Actions workflows
1 parent 59e3080 commit 1b4fd53

File tree

2 files changed

+182
-0
lines changed

2 files changed

+182
-0
lines changed

.github/workflows/on-push.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: On Push
2+
3+
on: [push]
4+
5+
jobs:
6+
BuildAndTest:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
configuration: ['Debug', 'Release']
11+
os: [ubuntu-latest, windows-latest, macos-latest]
12+
include:
13+
- os: windows-latest
14+
libframework: net45
15+
- os: ubuntu-latest
16+
libframework: netstandard2
17+
- os: macos-latest
18+
libframework: netstandard2
19+
steps:
20+
- uses: actions/checkout@v2
21+
22+
- name: Setup .NET Core
23+
if: matrix.libframework == 'netstandard2'
24+
uses: actions/setup-dotnet@v1
25+
with:
26+
dotnet-version: 2.2.108
27+
28+
- name: Build library
29+
run: dotnet build -c ${{ matrix.configuration }} -f ${{ matrix.libframework }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
30+
31+
- name: Restore test dependencies
32+
run: dotnet restore test/ICSharpCode.SharpZipLib.Tests/ICSharpCode.SharpZipLib.Tests.csproj
33+
34+
- name: Run tests (.NET Core)
35+
run: dotnet test -c ${{ matrix.configuration }} -f netcoreapp2.0
36+
37+
- name: Run tests (.NET Framework)
38+
if: matrix.os == 'windows'
39+
run: dotnet test -c ${{ matrix.configuration }} -f net45
40+
41+
42+
Package:
43+
if: 1 == 2
44+
needs: [BuildAndTest]
45+
runs-on: windows-latest
46+
env:
47+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
48+
49+
steps:
50+
- uses: actions/checkout@v2
51+
with:
52+
fetch-depth: 0
53+
# ref: v1.2.0
54+
55+
- name: Setup .NET Core
56+
uses: actions/setup-dotnet@v1
57+
with:
58+
dotnet-version: 2.2.108
59+
source-url: https://nuget.pkg.github.com/icsharpcode/index.json
60+
61+
#- name: Fix sourcelink
62+
# run: git fetch && git checkout origin/master -- src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj assets/ICSharpCode.SharpZipLib.snk
63+
64+
- name: Build library for .NET Standard 2
65+
run: dotnet build -c Release -f netstandard2 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
66+
- name: Build library for .NET Framework 4.5
67+
run: dotnet build -c Release -f net45 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
68+
69+
- name: Create nuget package
70+
run: dotnet pack src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:Version=$(git describe --abbrev | % { $_.substring(1) })
71+
72+
- name: Show package name
73+
run: ls dist\*.nupkg
74+
75+
- name: Publish the package to GPR
76+
if: false == true
77+
run: dotnet nuget push dist\*.nupkg

.github/workflows/pull-request.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Build and Test PR
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
7+
jobs:
8+
Build:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
configuration: ['Debug', 'Release']
13+
os: [ubuntu-latest, windows-latest, macos-latest]
14+
include:
15+
- os: windows-latest
16+
libframework: net45
17+
- os: ubuntu-latest
18+
libframework: netstandard2
19+
- os: macos-latest
20+
libframework: netstandard2
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup .NET Core
25+
if: matrix.libframework == 'netstandard2'
26+
uses: actions/setup-dotnet@v1
27+
with:
28+
dotnet-version: 2.2.108
29+
30+
- name: Build library
31+
run: dotnet build -c ${{ matrix.configuration }} -f ${{ matrix.libframework }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
32+
33+
- name: Restore test dependencies
34+
run: dotnet restore test/ICSharpCode.SharpZipLib.Tests/ICSharpCode.SharpZipLib.Tests.csproj
35+
36+
- name: Run tests (.NET Core)
37+
run: dotnet test -c ${{ matrix.configuration }} -f netcoreapp2.0
38+
39+
- name: Runt tests (.NET Framework)
40+
if: matrix.os == 'windows'
41+
run: dotnet test -c ${{ matrix.configuration }} -f net45
42+
43+
Test:
44+
runs-on: ${{ matrix.os }}
45+
strategy:
46+
matrix:
47+
configuration: ['Debug', 'Release']
48+
os: [ubuntu-latest, windows-latest, macos-latest]
49+
include:
50+
- os: windows-latest
51+
libframework: net45
52+
- os: ubuntu-latest
53+
libframework: netstandard2
54+
- os: macos-latest
55+
libframework: netstandard2
56+
steps:
57+
- uses: actions/checkout@v2
58+
59+
- name: Setup .NET Core
60+
if: matrix.libframework == 'netstandard2'
61+
uses: actions/setup-dotnet@v1
62+
with:
63+
dotnet-version: 2.2.108
64+
65+
- name: Restore test dependencies
66+
run: dotnet restore
67+
68+
- name: Run tests (.NET Core)
69+
run: dotnet test -c ${{ matrix.configuration }} -f netcoreapp2.0
70+
71+
- name: Run tests (.NET Framework)
72+
if: matrix.os == 'windows'
73+
run: dotnet test -c ${{ matrix.configuration }} -f net45
74+
75+
Pack:
76+
if: 1 == 2
77+
needs: [Build, Test]
78+
runs-on: windows-latest
79+
env:
80+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
81+
82+
steps:
83+
- uses: actions/checkout@v2
84+
with:
85+
fetch-depth: 0
86+
87+
- name: Setup .NET Core
88+
uses: actions/setup-dotnet@v1
89+
with:
90+
dotnet-version: 2.2.108
91+
source-url: https://nuget.pkg.github.com/icsharpcode/index.json
92+
93+
- name: Build library for .NET Standard 2
94+
run: dotnet build -c Release -f netstandard2 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
95+
- name: Build library for .NET Framework 4.5
96+
run: dotnet build -c Release -f net45 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
97+
98+
- name: Create nuget package
99+
run: dotnet pack src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:Version=$(git describe --abbrev | % { $_.substring(1) })-PR
100+
101+
- name: Upload nuget package artifact
102+
uses: actions/upload-artifact@v1
103+
with:
104+
name: Nuget package
105+
path: dist/*.nupkg

0 commit comments

Comments
 (0)