|
| 1 | +name: Build AvalonEdit |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + |
| 12 | + runs-on: windows-2022 |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + Configuration: [ Debug, Release ] |
| 16 | + env: |
| 17 | + Solution: '**/ICSharpCode.AvalonEdit.sln' |
| 18 | + BuildPlatform: 'Any CPU' |
| 19 | + BuildVersion: '6.1.3' |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v2 |
| 22 | + - name: Update project version |
| 23 | + uses: roryprimrose/set-vs-sdk-project-version@v1 |
| 24 | + with: |
| 25 | + projectFilter: '**/ICSharpCode.AvalonEdit.csproj' |
| 26 | + version: ${{ env.BuildVersion }}.${{ github.run_number }} |
| 27 | + assemblyVersion: ${{ env.BuildVersion }}.${{ github.run_number }} |
| 28 | + fileVersion: ${{ env.BuildVersion }}.${{ github.run_number }} |
| 29 | + |
| 30 | + - name: Setup .NET 3.1 (for unit tests only) |
| 31 | + uses: actions/setup-dotnet@v1 |
| 32 | + with: |
| 33 | + dotnet-version: 3.1.x |
| 34 | + |
| 35 | + - name: Setup .NET |
| 36 | + uses: actions/setup-dotnet@v1 |
| 37 | + with: |
| 38 | + dotnet-version: 6.0.x |
| 39 | + |
| 40 | + - name: Add msbuild to PATH |
| 41 | + uses: microsoft/setup-msbuild@v1.1 |
| 42 | + |
| 43 | + - run: msbuild ICSharpCode.AvalonEdit.sln /t:Restore /p:Configuration=${{ matrix.configuration }} |
| 44 | + |
| 45 | + - name: Build |
| 46 | + run: msbuild ICSharpCode.AvalonEdit.sln /p:Configuration=${{ matrix.configuration }} |
| 47 | + |
| 48 | + - name: Setup VSTest |
| 49 | + uses: Malcolmnixon/Setup-VSTest@v4 |
| 50 | + |
| 51 | + - name: net6.0-windows Unit Tests |
| 52 | + run: vstest.console $env:TestAssembly |
| 53 | + env: |
| 54 | + TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net6.0-windows\ICSharpCode.AvalonEdit.Tests.dll |
| 55 | + |
| 56 | + - name: netcoreapp3.1 Unit Tests |
| 57 | + run: vstest.console $env:TestAssembly |
| 58 | + env: |
| 59 | + TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\netcoreapp3.1\ICSharpCode.AvalonEdit.Tests.dll |
| 60 | + |
| 61 | + - name: net45 Unit Tests |
| 62 | + run: vstest.console $env:TestAssembly |
| 63 | + env: |
| 64 | + TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net45\ICSharpCode.AvalonEdit.Tests.dll |
| 65 | + |
| 66 | + - name: net40 Unit Tests |
| 67 | + run: vstest.console $env:TestAssembly |
| 68 | + env: |
| 69 | + TestAssembly: ICSharpCode.AvalonEdit.Tests\bin\${{ matrix.configuration }}\net40\ICSharpCode.AvalonEdit.Tests.dll |
| 70 | + |
| 71 | + - name: Style - tab check |
| 72 | + run: python BuildTools\tidy.py |
| 73 | + |
| 74 | + - name: Pack |
| 75 | + run: dotnet pack ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj -c ${{ matrix.configuration }} |
| 76 | + |
| 77 | + - name: Upload NuGet |
| 78 | + if: matrix.configuration == 'release' |
| 79 | + uses: actions/upload-artifact@v2 |
| 80 | + with: |
| 81 | + name: AvalonEdit NuGet Package (${{ matrix.configuration }}) |
| 82 | + path: ICSharpCode.AvalonEdit/bin/Release/AvalonEdit*.nupkg |
| 83 | + if-no-files-found: error |
| 84 | + |
| 85 | + - name: Upload Snupkg Artifact |
| 86 | + if: matrix.configuration == 'release' |
| 87 | + uses: actions/upload-artifact@v2 |
| 88 | + with: |
| 89 | + name: AvalonEdit Snupkg (${{ matrix.configuration }}) |
| 90 | + path: ICSharpCode.AvalonEdit/bin/Release/AvalonEdit*.snupkg |
| 91 | + if-no-files-found: error |
| 92 | + |
| 93 | + - name: Publish NuGet |
| 94 | + if: github.ref == 'refs/heads/master' && matrix.configuration == 'release' |
| 95 | + run: | |
| 96 | + dotnet nuget push "ICSharpCode.AvalonEdit\bin\Release\AvalonEdit*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }} |
0 commit comments