diff --git a/.github/workflows/pull-request.yml b/.github/workflows/build-test.yml similarity index 74% rename from .github/workflows/pull-request.yml rename to .github/workflows/build-test.yml index 85e91e8b2..f0b62e532 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/build-test.yml @@ -1,8 +1,11 @@ -name: Build and Test PR +name: Build and Test on: pull_request: branches: [ master ] + push: + branches: [ master ] + release: jobs: Build: @@ -64,14 +67,12 @@ jobs: - name: Upload coverage to Codecov uses: codecov/codecov-action@v1.2.2 - with: - fail_ci_if_error: false Pack: needs: [Build, Test] runs-on: windows-latest env: - NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + PKG_SUFFIX: '' steps: - uses: actions/checkout@v2 @@ -84,15 +85,19 @@ jobs: dotnet-version: '3.1.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 /p:ContinuousIntegrationBuild=true src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj - 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 /p:ContinuousIntegrationBuild=true 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 + run: dotnet build -c Release -f net45 /p:ContinuousIntegrationBuild=true src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj + + - name: Add PR suffix to package + if: ${{ github.event_name == 'pull_request' }} + run: echo "PKG_SUFFIX=-PR" >> $GITHUB_ENV - 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 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true /p:Version=$(git describe --abbrev | % { $_.substring(1) })${{ env.PKG_SUFFIX }} + - name: Upload nuget package artifact uses: actions/upload-artifact@v2 with: diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml deleted file mode 100644 index 3f34273d5..000000000 --- a/.github/workflows/on-push.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Build master on push - -env: - PUBLISH_DEV_PACKS: disabled - -on: - push: - branches: [ master ] - release: - -jobs: - BuildAndTest: - runs-on: ${{ matrix.os }}-latest - strategy: - fail-fast: false - matrix: - configuration: [debug, release] - os: [ubuntu, windows, macos] - libtarget: [netstandard2.0, netstandard2.1] - testtarget: [netcoreapp3.1] - include: - - configuration: debug - os: windows - libtarget: net45 - testtarget: net46 - - configuration: release - os: windows - libtarget: net45 - testtarget: net46 - steps: - - uses: actions/checkout@v2 - - - name: Setup .NET Core - 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 (Debug) - if: ${{ matrix.configuration == 'debug' }} - run: dotnet test -c debug -f ${{ matrix.testtarget }} --no-restore - - - name: Run tests (Release) - if: ${{ matrix.configuration == 'release' }} - run: dotnet test -c release -f ${{ matrix.testtarget }} --no-restore --collect="XPlat Code Coverage" - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1.2.2 - with: - fail_ci_if_error: false - - Codacy-Analysis: - runs-on: ubuntu-latest - name: Codacy Analysis CLI - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Run codacy-analysis-cli - uses: codacy/codacy-analysis-cli-action@1.1.0 - with: - # The current issues needs to be fixed before this can be removed - max-allowed-issues: 9999 - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - upload: true - - Package: - 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.0 - run: dotnet build -c Release -f netstandard2.0 /p:ContinuousIntegrationBuild=true src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj - - name: Build library for .NET Standard 2.1 - run: dotnet build -c Release -f netstandard2.1 /p:ContinuousIntegrationBuild=true src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj - - name: Build library for .NET Framework 4.5 - run: dotnet build -c Release -f net45 /p:ContinuousIntegrationBuild=true src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj - - - name: Create nuget package - run: dotnet pack src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true /p:Version=$(git describe --abbrev | % { $_.substring(1) }) - - - name: Upload nuget package artifact - uses: actions/upload-artifact@v2 - with: - name: Nuget package - path: dist/*.nupkg