From a1d5ee888fb61d392e859ac16e1f5e7113240813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Sat, 8 May 2021 16:38:07 +0200 Subject: [PATCH 1/3] ci: unify PR/push CI build actions --- .../{pull-request.yml => build-test.yml} | 23 ++-- .github/workflows/on-push.yml | 102 ------------------ 2 files changed, 14 insertions(+), 111 deletions(-) rename .github/workflows/{pull-request.yml => build-test.yml} (73%) delete mode 100644 .github/workflows/on-push.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/build-test.yml similarity index 73% rename from .github/workflows/pull-request.yml rename to .github/workflows/build-test.yml index 85e91e8b2..854ffcfa2 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" | 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 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 From 8e2bfb44b45b8d4bf1298f73a4ea790a3fc10f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Sat, 8 May 2021 16:58:24 +0200 Subject: [PATCH 2/3] ci: build packages using .net 5 for healthy nupkgs --- .github/workflows/build-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 854ffcfa2..37cffbb73 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -82,7 +82,7 @@ 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 /p:ContinuousIntegrationBuild=true src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj From b00a0c2b8761a0024bc3091368db56243cad5971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nils=20m=C3=A5s=C3=A9n?= Date: Sat, 8 May 2021 17:25:27 +0200 Subject: [PATCH 3/3] ci: simplify action syntax, use correct build flags --- .github/workflows/build-test.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 37cffbb73..5fb47261c 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -18,6 +18,8 @@ jobs: include: - os: windows target: net45 + env: + LIB_PROJ: src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj steps: - uses: actions/checkout@v2 @@ -27,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 @@ -73,6 +75,8 @@ jobs: 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 @@ -85,18 +89,18 @@ jobs: dotnet-version: '5.0.x' - 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 + 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 /p:ContinuousIntegrationBuild=true 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 /p:ContinuousIntegrationBuild=true 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:ContinuousIntegrationBuild=true /p:EmbedUntrackedSources=true /p:Version=$(git describe --abbrev | % { $_.substring(1) })${{ env.PKG_SUFFIX }} + 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