|
| 1 | +name: Build and Test PR |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: [ master ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + Build: |
| 9 | + runs-on: ${{ matrix.os }}-latest |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + configuration: [debug, release] |
| 14 | + os: [ubuntu, windows, macos] |
| 15 | + target: [netstandard2] |
| 16 | + include: |
| 17 | + - configuration: Debug |
| 18 | + os: windows |
| 19 | + target: net45 |
| 20 | + - configuration: Release |
| 21 | + os: windows |
| 22 | + target: net45 |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v2 |
| 25 | + |
| 26 | + - name: Setup .NET Core |
| 27 | + if: matrix.target == 'netstandard2' |
| 28 | + uses: actions/setup-dotnet@v1 |
| 29 | + with: |
| 30 | + dotnet-version: '3.1.x' |
| 31 | + |
| 32 | + - name: Build library |
| 33 | + run: dotnet build -c ${{ matrix.configuration }} -f ${{ matrix.target }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj |
| 34 | + |
| 35 | + Test: |
| 36 | + runs-on: ${{ matrix.os }}-latest |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + configuration: [debug, release] |
| 41 | + os: [ubuntu, windows, macos] |
| 42 | + target: [netcoreapp3.1] |
| 43 | + include: |
| 44 | + - configuration: debug |
| 45 | + os: windows |
| 46 | + target: net45 |
| 47 | + - configuration: release |
| 48 | + os: windows |
| 49 | + target: net45 |
| 50 | + steps: |
| 51 | + - uses: actions/checkout@v2 |
| 52 | + |
| 53 | + - name: Setup .NET Core |
| 54 | + if: matrix.target == 'netcoreapp3.1' |
| 55 | + uses: actions/setup-dotnet@v1 |
| 56 | + with: |
| 57 | + dotnet-version: '3.1.x' |
| 58 | + |
| 59 | + - name: Restore test dependencies |
| 60 | + run: dotnet restore |
| 61 | + |
| 62 | + - name: Run tests |
| 63 | + run: dotnet test -c ${{ matrix.configuration }} -f ${{ matrix.target }} --no-restore |
| 64 | + |
| 65 | + Codacy-Analysis: |
| 66 | + runs-on: ubuntu-latest |
| 67 | + name: Codacy Analysis CLI |
| 68 | + steps: |
| 69 | + - name: Checkout code |
| 70 | + uses: actions/checkout@v2 |
| 71 | + - name: Run codacy-analysis-cli |
| 72 | + |
| 73 | + with: |
| 74 | + # The current issues needs to be fixed before this can be removed |
| 75 | + max-allowed-issues: 9999 |
| 76 | + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} |
| 77 | + upload: true |
| 78 | + |
| 79 | + Pack: |
| 80 | + needs: [Build, Test] |
| 81 | + runs-on: windows-latest |
| 82 | + env: |
| 83 | + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 84 | + |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v2 |
| 87 | + with: |
| 88 | + fetch-depth: 0 |
| 89 | + |
| 90 | + - name: Setup .NET Core |
| 91 | + uses: actions/setup-dotnet@v1 |
| 92 | + with: |
| 93 | + dotnet-version: '3.1.x' |
| 94 | + |
| 95 | + - name: Build library for .NET Standard 2 |
| 96 | + run: dotnet build -c Release -f netstandard2 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj |
| 97 | + - name: Build library for .NET Framework 4.5 |
| 98 | + run: dotnet build -c Release -f net45 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj |
| 99 | + |
| 100 | + - name: Create nuget package |
| 101 | + run: dotnet pack src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:Version=$(git describe --abbrev | % { $_.substring(1) })-PR |
| 102 | + |
| 103 | + - name: Upload nuget package artifact |
| 104 | + uses: actions/upload-artifact@v2 |
| 105 | + with: |
| 106 | + name: Nuget package |
| 107 | + path: dist/*.nupkg |
0 commit comments