Skip to content

Commit

Permalink
PR #621: unify PR/push CI build actions
Browse files Browse the repository at this point in the history
* ci: unify PR/push CI build actions
* ci: build packages using .net 5 for healthy nupkgs
* ci: simplify action syntax, use correct build flags
  • Loading branch information
piksel authored May 8, 2021
1 parent 1b9fcfc commit fa08c7d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Build and Test PR
name: Build and Test

on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
release:

jobs:
Build:
Expand All @@ -15,6 +18,8 @@ jobs:
include:
- os: windows
target: net45
env:
LIB_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
steps:
- uses: actions/checkout@v2

Expand All @@ -24,10 +29,10 @@ jobs:
dotnet-version: '3.1.x'

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

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

Test:
runs-on: ${{ matrix.os }}-latest
Expand Down Expand Up @@ -64,14 +69,14 @@ jobs:

- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
fail_ci_if_error: false

Pack:
needs: [Build, Test]
runs-on: windows-latest
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
PKG_SUFFIX: ''
PKG_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
PKG_PROPS: '/p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true'

steps:
- uses: actions/checkout@v2
Expand All @@ -81,18 +86,22 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
dotnet-version: '5.0.x'

- name: Build library for .NET Standard 2.0
run: dotnet build -c Release -f netstandard2.0 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
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 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
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 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
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 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:Version=$(git describe --abbrev | % { $_.substring(1) })-PR
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:
Expand Down
102 changes: 0 additions & 102 deletions .github/workflows/on-push.yml

This file was deleted.

0 comments on commit fa08c7d

Please sign in to comment.