|
| 1 | +name: Continuous Integration |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main] |
| 5 | + pull_request: |
| 6 | + branches: [main] |
| 7 | +jobs: |
| 8 | + test: |
| 9 | + name: Test |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + steps: |
| 16 | + - name: Checkout sources |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + fetch-depth: 0 |
| 20 | + - name: Setup .NET Core 2.1 |
| 21 | + uses: actions/setup-dotnet@v1 |
| 22 | + with: |
| 23 | + dotnet-version: "2.1.x" |
| 24 | + - name: Setup .NET Core 3.1 |
| 25 | + uses: actions/setup-dotnet@v1 |
| 26 | + with: |
| 27 | + dotnet-version: "3.1.x" |
| 28 | + - name: Setup .NET |
| 29 | + uses: actions/setup-dotnet@v1 |
| 30 | + - name: Run tests |
| 31 | + run: dotnet test --collect:"XPlat Code Coverage" --logger "GitHubActions" |
| 32 | + - name: Upload coverage |
| 33 | + uses: actions/upload-artifact@v2 |
| 34 | + with: |
| 35 | + name: Code coverage ${{ matrix.os }} |
| 36 | + path: "**/coverage.cobertura.xml" |
| 37 | + coverage: |
| 38 | + name: Coverage |
| 39 | + needs: [test] |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - name: Checkout sources |
| 43 | + uses: actions/checkout@v2 |
| 44 | + - name: Setup .NET |
| 45 | + uses: actions/setup-dotnet@v1 |
| 46 | + - uses: actions/download-artifact@v2 |
| 47 | + with: |
| 48 | + name: Code coverage ubuntu-latest |
| 49 | + path: coverage-ubuntu |
| 50 | + - uses: actions/download-artifact@v2 |
| 51 | + with: |
| 52 | + name: Code coverage windows-latest |
| 53 | + path: coverage-windows |
| 54 | + - uses: actions/download-artifact@v2 |
| 55 | + with: |
| 56 | + name: Code coverage macos-latest |
| 57 | + path: coverage-macos |
| 58 | + - name: Generate coverage report |
| 59 | + uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12 |
| 60 | + with: |
| 61 | + reports: "**/coverage.cobertura.xml" |
| 62 | + targetdir: "coverage-report" |
| 63 | + reporttypes: "Cobertura" |
| 64 | + - name: Publish coverage report to Codacy |
| 65 | + uses: codacy/codacy-coverage-reporter-action@master |
| 66 | + if: github.repository == 'System-IO-Abstractions/System.IO.Abstractions.Extensions' && github.event_name == 'push' |
| 67 | + with: |
| 68 | + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} |
| 69 | + coverage-reports: coverage-report/Cobertura.xml |
| 70 | + pack: |
| 71 | + name: Pack |
| 72 | + needs: [test] |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - name: Checkout sources |
| 76 | + uses: actions/checkout@v2 |
| 77 | + with: |
| 78 | + fetch-depth: 0 |
| 79 | + - name: Setup .NET |
| 80 | + uses: actions/setup-dotnet@v1 |
| 81 | + - name: Create packages |
| 82 | + run: dotnet pack --configuration Release --output ./packages |
| 83 | + - name: Upload a Build Artifact |
| 84 | + uses: actions/upload-artifact@v2 |
| 85 | + with: |
| 86 | + name: NuGet packages |
| 87 | + path: packages/*.* |
| 88 | +# deploy: |
| 89 | +# name: Deploy |
| 90 | +# if: github.ref == 'refs/heads/main' && github.event_name == 'push' |
| 91 | +# needs: [pack] |
| 92 | +# runs-on: ubuntu-latest |
| 93 | +# steps: |
| 94 | +# - name: Checkout sources |
| 95 | +# uses: actions/checkout@v2 |
| 96 | +# with: |
| 97 | +# fetch-depth: 0 |
| 98 | +# - name: Setup .NET |
| 99 | +# uses: actions/setup-dotnet@v1 |
| 100 | +# - uses: actions/download-artifact@v2 |
| 101 | +# with: |
| 102 | +# name: NuGet packages |
| 103 | +# path: packages |
| 104 | +# - name: Push packages |
| 105 | +# run: dotnet nuget push "packages/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |
| 106 | +# - uses: dotnet/nbgv@v0.4.0 |
| 107 | +# id: nbgv |
| 108 | +# - name: Create GitHub release |
| 109 | +# uses: actions/create-release@v1 |
| 110 | +# env: |
| 111 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 112 | +# with: |
| 113 | +# tag_name: v${{ steps.nbgv.outputs.SemVer2 }} |
| 114 | +# release_name: v${{ steps.nbgv.outputs.SemVer2 }} |
| 115 | +# - name: Comment relevant issues and merge requests |
| 116 | +# uses: apexskier/github-release-commenter@v1.3.2 |
| 117 | +# with: |
| 118 | +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 119 | +# comment-template: | |
| 120 | +# This is addressed in release {release_link}. |
| 121 | +# label-template: | |
| 122 | +# state: released |
0 commit comments