|
| 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 }} |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + configuration: ['Debug', 'Release'] |
| 13 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 14 | + include: |
| 15 | + - os: windows-latest |
| 16 | + libframework: net45 |
| 17 | + - os: ubuntu-latest |
| 18 | + libframework: netstandard2 |
| 19 | + - os: macos-latest |
| 20 | + libframework: netstandard2 |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Setup .NET Core |
| 25 | + if: matrix.libframework == 'netstandard2' |
| 26 | + uses: actions/setup-dotnet@v1 |
| 27 | + with: |
| 28 | + dotnet-version: 2.2.108 |
| 29 | + |
| 30 | + - name: Build library |
| 31 | + run: dotnet build -c ${{ matrix.configuration }} -f ${{ matrix.libframework }} src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj |
| 32 | + |
| 33 | + - name: Restore test dependencies |
| 34 | + run: dotnet restore test/ICSharpCode.SharpZipLib.Tests/ICSharpCode.SharpZipLib.Tests.csproj |
| 35 | + |
| 36 | + - name: Run tests (.NET Core) |
| 37 | + run: dotnet test -c ${{ matrix.configuration }} -f netcoreapp2.0 |
| 38 | + |
| 39 | + - name: Runt tests (.NET Framework) |
| 40 | + if: matrix.os == 'windows' |
| 41 | + run: dotnet test -c ${{ matrix.configuration }} -f net45 |
| 42 | + |
| 43 | + Test: |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + configuration: ['Debug', 'Release'] |
| 48 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 49 | + include: |
| 50 | + - os: windows-latest |
| 51 | + libframework: net45 |
| 52 | + - os: ubuntu-latest |
| 53 | + libframework: netstandard2 |
| 54 | + - os: macos-latest |
| 55 | + libframework: netstandard2 |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v2 |
| 58 | + |
| 59 | + - name: Setup .NET Core |
| 60 | + if: matrix.libframework == 'netstandard2' |
| 61 | + uses: actions/setup-dotnet@v1 |
| 62 | + with: |
| 63 | + dotnet-version: 2.2.108 |
| 64 | + |
| 65 | + - name: Restore test dependencies |
| 66 | + run: dotnet restore |
| 67 | + |
| 68 | + - name: Run tests (.NET Core) |
| 69 | + run: dotnet test -c ${{ matrix.configuration }} -f netcoreapp2.0 |
| 70 | + |
| 71 | + - name: Run tests (.NET Framework) |
| 72 | + if: matrix.os == 'windows' |
| 73 | + run: dotnet test -c ${{ matrix.configuration }} -f net45 |
| 74 | + |
| 75 | + Pack: |
| 76 | + if: 1 == 2 |
| 77 | + needs: [Build, Test] |
| 78 | + runs-on: windows-latest |
| 79 | + env: |
| 80 | + NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 81 | + |
| 82 | + steps: |
| 83 | + - uses: actions/checkout@v2 |
| 84 | + with: |
| 85 | + fetch-depth: 0 |
| 86 | + |
| 87 | + - name: Setup .NET Core |
| 88 | + uses: actions/setup-dotnet@v1 |
| 89 | + with: |
| 90 | + dotnet-version: 2.2.108 |
| 91 | + source-url: https://nuget.pkg.github.com/icsharpcode/index.json |
| 92 | + |
| 93 | + - name: Build library for .NET Standard 2 |
| 94 | + run: dotnet build -c Release -f netstandard2 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj |
| 95 | + - name: Build library for .NET Framework 4.5 |
| 96 | + run: dotnet build -c Release -f net45 src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj |
| 97 | + |
| 98 | + - name: Create nuget package |
| 99 | + run: dotnet pack src/ICSharpCode.SharpZipLib/ICSharpCode.SharpZipLib.csproj --configuration Release --output dist /p:Version=$(git describe --abbrev | % { $_.substring(1) })-PR |
| 100 | + |
| 101 | + - name: Upload nuget package artifact |
| 102 | + uses: actions/upload-artifact@v1 |
| 103 | + with: |
| 104 | + name: Nuget package |
| 105 | + path: dist/*.nupkg |
0 commit comments