|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened, closed] |
| 8 | + branches: [ main ] |
| 9 | + |
| 10 | +env: |
| 11 | + configuration: Release |
| 12 | + productNamespacePrefix: "Akavache" |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: windows-latest |
| 17 | + outputs: |
| 18 | + nbgv: ${{ steps.nbgv.outputs.SemVer2 }} |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v2 |
| 22 | + with: |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Install .NET Core |
| 26 | + uses: actions/setup-dotnet@v1 |
| 27 | + with: |
| 28 | + dotnet-version: 3.1.x |
| 29 | + |
| 30 | + - name: Use Node.js |
| 31 | + uses: actions/setup-node@v1 |
| 32 | + with: |
| 33 | + node-version: '12.x' |
| 34 | + |
| 35 | + - name: NuGet restore |
| 36 | + run: dotnet restore |
| 37 | + working-directory: src |
| 38 | + |
| 39 | + - name: NBGV |
| 40 | + id: nbgv |
| 41 | + uses: dotnet/nbgv@master |
| 42 | + with: |
| 43 | + setAllVars: true |
| 44 | + |
| 45 | + - name: Add MSBuild to PATH |
| 46 | + uses: microsoft/setup-msbuild@v1 |
| 47 | + |
| 48 | + - name: Build |
| 49 | + run: msbuild /t:build,pack /maxcpucount /p:NoPackageAnalysis=true /verbosity:minimal /p:Configuration=${{ env.configuration }} |
| 50 | + working-directory: src |
| 51 | + |
| 52 | + - name: Run Unit Tests and Generate Coverage |
| 53 | + uses: glennawatson/coverlet-msbuild@v1 |
| 54 | + with: |
| 55 | + project-files: '**/*Tests*.csproj' |
| 56 | + no-build: true |
| 57 | + exclude-filter: '[${{env.productNamespacePrefix}}.*.Tests.*]*' |
| 58 | + include-filter: '[${{env.productNamespacePrefix}}*]*' |
| 59 | + output-format: opencover |
| 60 | + merge-with: '../../artifacts/coverage/coverage.json' |
| 61 | + output: '../../artifacts/coverage/' |
| 62 | + configuration: ${{ env.configuration }} |
| 63 | + |
| 64 | + - name: Combine Coverage Reports |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + dotnet tool install --global dotnet-reportgenerator-globaltool |
| 68 | + reportgenerator -reports:artifacts/coverage/*.xml -targetdir:artifacts/finalcoverage -reporttypes:Cobertura |
| 69 | +
|
| 70 | + - name: Upload Code Coverage |
| 71 | + run: | |
| 72 | + npm install -g codecov |
| 73 | + codecov |
| 74 | + working-directory: artifacts/finalcoverage |
| 75 | + env: |
| 76 | + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
| 77 | + |
| 78 | + - name: Create NuGet Artifacts |
| 79 | + uses: actions/upload-artifact@master |
| 80 | + with: |
| 81 | + name: nuget |
| 82 | + path: '**/*.nupkg' |
| 83 | + |
| 84 | + release: |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: build |
| 87 | + if: contains(github.event.pull_request.labels.*.name, 'release') && github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true |
| 88 | + steps: |
| 89 | + - name: Checkout |
| 90 | + uses: actions/checkout@v2 |
| 91 | + with: |
| 92 | + fetch-depth: 0 |
| 93 | + |
| 94 | + - name: Download NuGet Packages |
| 95 | + uses: actions/download-artifact@v2 |
| 96 | + with: |
| 97 | + name: nuget |
| 98 | + |
| 99 | + - name: Save SignClient Configuration |
| 100 | + run: 'echo "$SIGN_CLIENT_CONFIG" > SignPackages.json' |
| 101 | + shell: bash |
| 102 | + env: |
| 103 | + SIGN_CLIENT_CONFIG: ${{secrets.SIGN_CLIENT_CONFIG}} |
| 104 | + |
| 105 | + - name: Sign NuGet Packages |
| 106 | + uses: glennawatson/signclient@v1 |
| 107 | + with: |
| 108 | + input-files: '**/*.nupkg' |
| 109 | + sign-client-secret: ${{ secrets.SIGN_CLIENT_SECRET }} |
| 110 | + sign-client-user: ${{ secrets.SIGN_CLIENT_USER_ID }} |
| 111 | + project-name: reactiveui |
| 112 | + description: reactiveui |
| 113 | + config-file: SignPackages.json |
| 114 | + |
| 115 | + - name: Changelog |
| 116 | + uses: glennawatson/ChangeLog@v1 |
| 117 | + id: changelog |
| 118 | + |
| 119 | + - name: Create Release |
| 120 | + uses: actions/create-release@v1 |
| 121 | + env: |
| 122 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 123 | + with: |
| 124 | + tag_name: ${{ needs.build.outputs.nbgv }} |
| 125 | + release_name: ${{ needs.build.outputs.nbgv }} |
| 126 | + body: | |
| 127 | + ${{ steps.changelog.outputs.commitLog }} |
| 128 | +
|
| 129 | + - name: NuGet Push |
| 130 | + env: |
| 131 | + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} |
| 132 | + SOURCE_URL: https://api.nuget.org/v3/index.json |
| 133 | + run: | |
| 134 | + dotnet nuget push -s ${{ env.SOURCE_URL }} -k ${{ env.NUGET_AUTH_TOKEN }} **/*.nupkg |
| 135 | +
|
0 commit comments