-
Notifications
You must be signed in to change notification settings - Fork 968
116 lines (96 loc) · 3.65 KB
/
build-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Build and Test
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
release:
jobs:
Build:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
target: [netstandard2.0, netstandard2.1]
include:
- os: windows
target: net45
env:
LIB_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Build library (Debug)
run: dotnet build -c debug -f ${{ matrix.target }} ${{ env.LIB_PROJ }}
- name: Build library (Release)
run: dotnet build -c release -f ${{ matrix.target }} ${{ env.LIB_PROJ }}
Test:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
target: [netcoreapp3.1]
include:
- os: windows
target: net46
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
if: matrix.target == 'netcoreapp3.1'
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
# NOTE: This is the temporary fix for https://github.com/actions/virtual-environments/issues/1090
- name: Cleanup before restore
if: ${{ matrix.os == 'windows' }}
run: dotnet clean ICSharpCode.SharpZipLib.sln && dotnet nuget locals all --clear
- name: Restore test dependencies
run: dotnet restore
- name: Run tests (Debug)
run: dotnet test -c debug -f ${{ matrix.target }} --no-restore
- name: Run tests (Release)
# Only upload code coverage for windows in an attempt to fix the broken code coverage
if: ${{ matrix.os == 'windows' }}
run: dotnet test -c release -f ${{ matrix.target }} --no-restore --collect="XPlat Code Coverage"
- name: Run tests with coverage (Release)
# Only upload code coverage for windows in an attempt to fix the broken code coverage
if: ${{ matrix.os != 'windows' }}
run: dotnet test -c release -f ${{ matrix.target }} --no-restore
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.2.2
Pack:
needs: [Build, Test]
runs-on: windows-latest
env:
PKG_SUFFIX: ''
PKG_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
PKG_PROPS: '/p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Build library for .NET Standard 2.0
run: dotnet build -c Release -f netstandard2.0 ${{ env.PKG_PROPS }} ${{ env.PKG_PROJ }}
- name: Build library for .NET Standard 2.1
run: dotnet build -c Release -f netstandard2.1 ${{ env.PKG_PROPS }} ${{ env.PKG_PROJ }}
- name: Build library for .NET Framework 4.5
run: dotnet build -c Release -f net45 ${{ env.PKG_PROPS }} ${{ env.PKG_PROJ }}
- name: Add PR suffix to package
if: ${{ github.event_name == 'pull_request' }}
run: echo "PKG_SUFFIX=-PR" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Create nuget package
run: dotnet pack ${{ env.PKG_PROJ }} -c Release --output dist ${{ env.PKG_PROPS }} /p:Version=$(git describe --abbrev | % { $_.substring(1) })${{ env.PKG_SUFFIX }}
- name: Upload nuget package artifact
uses: actions/upload-artifact@v2
with:
name: Nuget package
path: dist/*.nupkg