|
1 |
| -# This is a basic workflow to help you get started with Actions |
| 1 | +# This workflow will build a .NET project |
2 | 2 |
|
3 | 3 | name: CI
|
4 | 4 |
|
5 |
| -# Controls when the workflow will run |
6 | 5 | on:
|
7 |
| - # Triggers the workflow on push or pull request events but only for the "main" branch |
8 | 6 | push:
|
9 |
| - branches: [ "main", "develop", "/release/.*/", "/hotfix/.*/" ] |
| 7 | + branches: |
| 8 | + - master |
| 9 | + - develop |
| 10 | + - "feature/**" |
| 11 | + - "release/**" |
| 12 | + - "hotfix/**" |
| 13 | + tags: |
| 14 | + - "*" |
10 | 15 | pull_request:
|
11 |
| - branches: [ "main", "develop", "/release/.*/", "/hotfix/.*/" ] |
12 | 16 |
|
13 |
| - # Allows you to run this workflow manually from the Actions tab |
14 |
| - workflow_dispatch: |
| 17 | +defaults: |
| 18 | + run: |
| 19 | + working-directory: src |
15 | 20 |
|
16 |
| -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
17 | 21 | jobs:
|
18 |
| - # This workflow contains a single job called "build" |
19 | 22 | build:
|
20 |
| - # The type of runner that the job will run on |
21 |
| - runs-on: ubuntu-latest |
| 23 | + env: |
| 24 | + BUILD_CONFIG: "Release" |
| 25 | + |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + strategy: |
| 28 | + matrix: |
| 29 | + os: [windows-latest, ubuntu-latest, macos-latest] |
22 | 30 |
|
23 |
| - # Steps represent a sequence of tasks that will be executed as part of the job |
24 | 31 | steps:
|
25 |
| - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
26 |
| - - uses: actions/checkout@v3 |
| 32 | + - uses: actions/checkout@v3 |
27 | 33 |
|
28 |
| - # Runs a single command using the runners shell |
29 |
| - - name: Build Solution |
30 |
| - shell: pwsh |
| 34 | + - name: Get Build Version |
31 | 35 | run: |
|
32 |
| - ./build.ps1 |
| 36 | + Import-Module ..\build\GetBuildVersion.psm1 |
| 37 | + Write-Host $Env:GITHUB_REF |
| 38 | + $version = GetBuildVersion -VersionString $Env:GITHUB_REF |
| 39 | + echo "BUILD_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append |
| 40 | + shell: pwsh |
| 41 | + |
| 42 | + - name: Setup .NET |
| 43 | + uses: actions/setup-dotnet@v3 |
| 44 | + with: |
| 45 | + dotnet-version: 6.0.x |
| 46 | + |
| 47 | + - name: Restore dependencies |
| 48 | + run: dotnet restore |
| 49 | + |
| 50 | + - name: Build |
| 51 | + run: dotnet build --configuration $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore |
| 52 | + |
| 53 | + - name: Test |
| 54 | + run: dotnet test -p:Configuration=$BUILD_CONFIG --no-restore --no-build --verbosity normal --collect:"XPlat Code Coverage" |
| 55 | + |
| 56 | + - name: Codecov |
| 57 | + |
| 58 | + with: |
| 59 | + token: ${{ secrets.CODECOVACCESSTOKEN }} # not required for public repos |
| 60 | + |
| 61 | + - name: Setup NuGet |
| 62 | + uses: NuGet/setup-nuget@v1 |
| 63 | + |
| 64 | + - name: Publish NuGet |
| 65 | + if: startsWith(github.ref, 'refs/heads/Release') |
| 66 | + run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGETORGAPI}} |
| 67 | + |
| 68 | + # - name: Code Coverage Report |
| 69 | + |
| 70 | + # with: |
| 71 | + # filename: coverage/**/coverage.cobertura.xml |
| 72 | + # badge: true |
| 73 | + # fail_below_min: true |
| 74 | + # format: markdown |
| 75 | + # hide_branch_rate: false |
| 76 | + # hide_complexity: true |
| 77 | + # indicators: true |
| 78 | + # output: both |
| 79 | + # thresholds: "60 80" |
| 80 | + |
| 81 | + # - name: Add Coverage PR Comment |
| 82 | + # uses: marocchino/sticky-pull-request-comment@v2 |
| 83 | + # if: github.event_name == 'pull_request' |
| 84 | + # with: |
| 85 | + # recreate: true |
| 86 | + # path: code-coverage-results.md |
0 commit comments