Improve zip file iteration performance #291
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag Ref' | |
required: true | |
pull_request: | |
branches: [ master ] | |
push: | |
branches: [ master ] | |
release: | |
jobs: | |
Build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
target: [netstandard2.0, netstandard2.1, net6.0] | |
env: | |
LIB_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.events.inputs.tag }} | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- name: Show .NET info | |
run: dotnet --info | |
- 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: | |
# Windows testing is combined with code coverage | |
os: [ubuntu, macos] | |
target: [net6.0] | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
if: matrix.target == 'net6.0' | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
- 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) | |
run: dotnet test -c release -f ${{ matrix.target }} --no-restore | |
CodeCov: | |
name: Code Coverage | |
runs-on: windows-2019 | |
env: | |
DOTCOVER_VER: 2021.1.2 | |
DOTCOVER_PKG: jetbrains.dotcover.commandlinetools | |
COVER_SNAPSHOT: SharpZipLib.dcvr | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0.x' | |
# NOTE: This is the temporary fix for https://github.com/actions/virtual-environments/issues/1090 | |
- name: Cleanup before restore | |
run: dotnet clean ICSharpCode.SharpZipLib.sln && dotnet nuget locals all --clear | |
- name: Install codecov | |
run: nuget install -o tools -version ${{env.DOTCOVER_VER}} ${{env.DOTCOVER_PKG}} | |
- name: Add dotcover to path | |
run: echo "$(pwd)\tools\${{env.DOTCOVER_PKG}}.${{env.DOTCOVER_VER}}\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Run tests with code coverage | |
run: dotcover dotnet --output=${{env.COVER_SNAPSHOT}} --filters=-:ICSharpCode.SharpZipLib.Tests -- test -c release | |
- name: Create code coverage report | |
run: dotcover report --source=${{env.COVER_SNAPSHOT}} --reporttype=detailedxml --output=dotcover-report.xml | |
- name: Upload coverage to Codecov | |
uses: codecov/[email protected] | |
with: | |
files: dotcover-report.xml | |
- name: Upload coverage snapshot artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Code coverage snapshot | |
path: ${{env.COVER_SNAPSHOT}} | |
Pack: | |
needs: [Build, Test, CodeCov] | |
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: | |
ref: ${{ github.events.inputs.tag }} | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.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 6.0 | |
run: dotnet build -c Release -f net6.0 ${{ 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: Set package version | |
continue-on-error: true | |
run: |- | |
$PKG_GIT_VERSION="$(git describe --tags --abbrev | % { $_.substring(1) })" | |
Write-Output "::notice::Git describe: $PKG_GIT_VERSION" | |
Write-Output "::notice::Package suffix: $env:PKG_SUFFIX" | |
$PKG_VERSION = "${PKG_GIT_VERSION}${env:PKG_SUFFIX}" | |
Write-Output "::notice::Package version: $PKG_VERSION" | |
Write-Output "PKG_VERSION=$PKG_VERSION" | 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=${{ env.PKG_VERSION }} | |
- name: Upload nuget package artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Nuget package | |
path: dist/*.nupkg |