forked from MudBlazor/MudBlazor
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (97 loc) · 3.49 KB
/
template-pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: template-pipeline
on:
workflow_call:
inputs:
dotnet-version:
description: 'dotnet version to install'
required: false
type: string
default: '6.0.x'
dotnet-prerelease:
required: false
type: boolean
default: false
publish-coverage:
required: false
type: boolean
default: false
pack-library:
required: false
type: boolean
default: false
deploy-web-app:
required: false
type: boolean
default: false
deploy-condition:
required: false
type: string
deploy-web-app-name:
description: 'name of the azure app only needed if deploy web app is true'
required: false
type: string
deploy-web-app-slot-name:
description: 'name of the azure app slot name only needed if deploy web app is true'
required: false
type: string
default: 'production'
secrets:
publish-profile:
required: false
jobs:
ci:
name: Build & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install eslint
run: npm i -g eslint
- name: Check JS is ES6 compliant
run: eslint --env 'es6' MudBlazor/TScripts
- name: Setup dotnet version
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ inputs.dotnet-version }}
include-prerelease: ${{ inputs.dotnet-prerelease }}
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release --no-build --no-restore --blame-hang --blame-hang-timeout 60s /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:ExcludeByAttribute='ExcludeFromCodeCoverage' /p:Include='[MudBlazor]*' /p:SkipAutoProps=true /p:CoverletOutput='./TestResults/'
- name: Coverage
if: ${{ inputs.publish-coverage == true }}
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.cobertura.xml
- name: Publish
if: ${{ inputs.deploy-web-app == true }}
run: dotnet publish ./MudBlazor.Docs.Server -c Release --runtime win-x64 --self-contained -o ${{env.DOTNET_ROOT}}/${{ inputs.deploy-web-app-name }}
- uses: actions/upload-artifact@v2
if: ${{ inputs.deploy-web-app == true }}
with:
name: ${{ inputs.deploy-web-app-name }}
path: ${{env.DOTNET_ROOT}}/${{ inputs.deploy-web-app-name }}
cd:
name: Deploy
needs: ci
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' && inputs.deploy-web-app == true && github.repository_owner == 'MudBlazor' && github.ref == inputs.deploy-condition }}
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v2.0.10
with:
name: ${{ inputs.deploy-web-app-name }}
path: ${{ inputs.deploy-web-app-name }}
- name: Deploy to Azure
uses: azure/webapps-deploy@v2
with:
app-name: ${{ inputs.deploy-web-app-name }}
slot-name: ${{ inputs.deploy-web-app-slot-name }}
publish-profile: ${{ secrets.publish-profile }}
package: ${{ inputs.deploy-web-app-name }}