Skip to content

Commit fa08c7d

Browse files
authored
PR #621: unify PR/push CI build actions
* ci: unify PR/push CI build actions * ci: build packages using .net 5 for healthy nupkgs * ci: simplify action syntax, use correct build flags
1 parent 1b9fcfc commit fa08c7d

File tree

2 files changed

+21
-114
lines changed

2 files changed

+21
-114
lines changed
Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
name: Build and Test PR
1+
name: Build and Test
22

33
on:
44
pull_request:
55
branches: [ master ]
6+
push:
7+
branches: [ master ]
8+
release:
69

710
jobs:
811
Build:
@@ -15,6 +18,8 @@ jobs:
1518
include:
1619
- os: windows
1720
target: net45
21+
env:
22+
LIB_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
1823
steps:
1924
- uses: actions/checkout@v2
2025

@@ -24,10 +29,10 @@ jobs:
2429
dotnet-version: '3.1.x'
2530

2631
- name: Build library (Debug)
27-
run: dotnet build -c debug -f ${{ matrix.target }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
32+
run: dotnet build -c debug -f ${{ matrix.target }} ${{ env.LIB_PROJ }}
2833

2934
- name: Build library (Release)
30-
run: dotnet build -c release -f ${{ matrix.target }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
35+
run: dotnet build -c release -f ${{ matrix.target }} ${{ env.LIB_PROJ }}
3136

3237
Test:
3338
runs-on: ${{ matrix.os }}-latest
@@ -64,14 +69,14 @@ jobs:
6469

6570
- name: Upload coverage to Codecov
6671
uses: codecov/[email protected]
67-
with:
68-
fail_ci_if_error: false
6972

7073
Pack:
7174
needs: [Build, Test]
7275
runs-on: windows-latest
7376
env:
74-
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
77+
PKG_SUFFIX: ''
78+
PKG_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
79+
PKG_PROPS: '/p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true'
7580

7681
steps:
7782
- uses: actions/checkout@v2
@@ -81,18 +86,22 @@ jobs:
8186
- name: Setup .NET Core
8287
uses: actions/setup-dotnet@v1
8388
with:
84-
dotnet-version: '3.1.x'
89+
dotnet-version: '5.0.x'
8590

8691
- name: Build library for .NET Standard 2.0
87-
run: dotnet build -c Release -f netstandard2.0 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
92+
run: dotnet build -c Release -f netstandard2.0 ${{ env.PKG_PROPS }} ${{ env.PKG_PROJ }}
8893
- name: Build library for .NET Standard 2.1
89-
run: dotnet build -c Release -f netstandard2.1 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
94+
run: dotnet build -c Release -f netstandard2.1 ${{ env.PKG_PROPS }} ${{ env.PKG_PROJ }}
9095
- name: Build library for .NET Framework 4.5
91-
run: dotnet build -c Release -f net45 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
96+
run: dotnet build -c Release -f net45 ${{ env.PKG_PROPS }} ${{ env.PKG_PROJ }}
97+
98+
- name: Add PR suffix to package
99+
if: ${{ github.event_name == 'pull_request' }}
100+
run: echo "PKG_SUFFIX=-PR" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
92101

93102
- name: Create nuget package
94-
run: dotnet pack src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:Version=$(git describe --abbrev | % { $_.substring(1) })-PR
95-
103+
run: dotnet pack ${{ env.PKG_PROJ }} -c Release --output dist ${{ env.PKG_PROPS }} /p:Version=$(git describe --abbrev | % { $_.substring(1) })${{ env.PKG_SUFFIX }}
104+
96105
- name: Upload nuget package artifact
97106
uses: actions/upload-artifact@v2
98107
with:

.github/workflows/on-push.yml

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

0 commit comments

Comments
 (0)