Skip to content

Commit

Permalink
Use github workflows for CI (icsharpcode#419)
Browse files Browse the repository at this point in the history
* Add Github Actions workflows

* Use VS 2019 in AppVeyor CI
  • Loading branch information
piksel authored Aug 15, 2020
1 parent 96b4d86 commit 63e7e70
Show file tree
Hide file tree
Showing 6 changed files with 340 additions and 82 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ indent_size = 2
end_of_line = lf
[*.{cmd, bat}]
end_of_line = crlf

[*.yml]
indent_style = space
indent_size = 2
79 changes: 79 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build master on push

env:
PUBLISH_DEV_PACKS: disabled

on:
push:
branches: [ master ]

jobs:
BuildAndTest:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
configuration: [debug, release]
os: [ubuntu, windows, macos]
libtarget: [netstandard2]
testtarget: [netcoreapp3.1]
include:
- configuration: debug
os: windows
libtarget: net45
testtarget: net45
- configuration: release
os: windows
libtarget: net45
testtarget: net45
steps:
- uses: actions/checkout@v2

- name: Setup .NET Core
if: matrix.libtarget == 'netstandard2'
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'

- name: Build library
run: dotnet build -c ${{ matrix.configuration }} -f ${{ matrix.libtarget }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj

- name: Restore test dependencies
run: dotnet restore

- name: Run tests
run: dotnet test -c ${{ matrix.configuration }} -f ${{ matrix.testtarget }} --no-restore


Package:
if: env.PUBLISH_DEV_PACKS != 'disabled'
needs: [BuildAndTest]
runs-on: windows-latest
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
source-url: https://nuget.pkg.github.com/icsharpcode/index.json

- name: Build library for .NET Standard 2
run: dotnet build -c Release -f netstandard2 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
- name: Build library for .NET Framework 4.5
run: dotnet build -c Release -f net45 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj

- name: Create nuget package
run: dotnet pack src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:Version=$(git describe --abbrev | % { $_.substring(1) })

- name: Show package name
run: ls dist\*.nupkg

- name: Publish the package to GPR
if: env.PUBLISH_DEV_PACKS == 'enabled'
run: dotnet nuget push dist\*.nupkg
93 changes: 93 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build and Test PR

on:
pull_request:
branches: [ master ]

jobs:
Build:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
configuration: [debug, release]
os: [ubuntu, windows, macos]
target: [netstandard2]
include:
- configuration: Debug
os: windows
target: net45
- configuration: Release
os: windows
target: net45
steps:
- uses: actions/checkout@v2

- name: Setup .NET Core
if: matrix.target == 'netstandard2'
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'

- name: Build library
run: dotnet build -c ${{ matrix.configuration }} -f ${{ matrix.target }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj

Test:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
configuration: [debug, release]
os: [ubuntu, windows, macos]
target: [netcoreapp3.1]
include:
- configuration: debug
os: windows
target: net45
- configuration: release
os: windows
target: net45
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'

- name: Restore test dependencies
run: dotnet restore

- name: Run tests
run: dotnet test -c ${{ matrix.configuration }} -f ${{ matrix.target }} --no-restore

Pack:
needs: [Build, Test]
runs-on: windows-latest
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'

- name: Build library for .NET Standard 2
run: dotnet build -c Release -f netstandard2 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj
- name: Build library for .NET Framework 4.5
run: dotnet build -c Release -f net45 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj

- 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

- name: Upload nuget package artifact
uses: actions/upload-artifact@v2
with:
name: Nuget package
path: dist/*.nupkg
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '{build}'
image: Visual Studio 2017
image: Visual Studio 2019
configuration:
- Debug
- Release
Expand Down Expand Up @@ -31,4 +31,4 @@ test_script:
artifacts:
- path: docs\help\_site
type: zip
name: Documentation
name: Documentation
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net46</TargetFrameworks>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>
Expand Down
Loading

0 comments on commit 63e7e70

Please sign in to comment.