forked from ng-alain/delon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
129 lines (121 loc) · 4.23 KB
/
azure-pipelines.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: ng-alain-delon
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: env
jobs:
- job: Nodes
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.10.0'
displayName: 'Install Node.js'
- stage: build
jobs:
- job: build
steps:
- task: NodeTool@0
inputs:
versionSpec: '18.10.0'
displayName: 'Install Node.js'
- script: |
node --version
yarn --version
yarn config list
yarn install
displayName: 'Install'
- task: Bash@3
env:
ACCESS_TOKEN: $(ACCESS_TOKEN)
inputs:
targetType: 'filePath'
filePath: 'scripts/ci/build-artifacts.sh'
displayName: 'Build artifacts'
- script: |
node ./scripts/azure/github-comment.js "[Preview Preparing...](https://dev.azure.com/ng-alain/delon/_build/results?buildId=$(Build.BuildId))"
displayName: 'Comment on github'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
- script: |
yarn run site:build:ssr
displayName: 'Build site'
- script: |
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh
echo "Deploy to $DEPLOY_DOMAIN"
cp ./src/dist/browser/index.html ./src/dist/browser/404.html
npx surge --project ./src/dist/browser --domain $DEPLOY_DOMAIN
displayName: 'Deploy Site'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
SURGE_LOGIN: $(SURGE_LOGIN)
SURGE_TOKEN: $(SURGE_TOKEN)
- script: |
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ng-alain-delon.surge.sh
node ./scripts/azure/github-comment.js "[Preview is ready!]($DEPLOY_DOMAIN)"
displayName: 'Update comment on github'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
- job: Build_Failed
dependsOn: Build
condition: failed()
steps:
- checkout: self
displayName: 'Checkout'
clean: true
fetchDepth: 1
- script: yarn install
displayName: 'Install modules'
- script: |
node ./scripts/azure/github-comment.js "[Preview Failed](https://dev.azure.com/ng-alain/delon/_build/results?buildId=$(Build.BuildId))"
displayName: 'Comment on github'
env:
ACCESS_REPO: $(ACCESS_REPO)
ACCESS_TOKEN: $(ACCESS_TOKEN)
dependsOn: env
- stage: test
jobs:
- job: packages
steps:
- script: yarn install
displayName: 'Install'
- script: |
yarn run test
cat ./coverage/lcov.info | ./node_modules/.bin/codecov
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
- task: PublishCodeCoverageResults@1
displayName: 'publish code coverage results'
condition: succeededOrFailed()
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(System.DefaultWorkingDirectory)/coverage/cobertura-coverage.xml
reportDirectory: $(System.DefaultWorkingDirectory)/coverage
failIfCoverageEmpty: true
- task: PublishTestResults@2
displayName: 'publish test results'
condition: succeededOrFailed()
inputs:
searchFolder: $(System.DefaultWorkingDirectory)/junit
failTaskOnFailedTests: true
testRunTitle: DELON
testResultsFormat: JUnit
testResultsFiles: '**/TESTS*.xml'
- job: cli
steps:
- script: yarn install
displayName: 'Install'
- script: yarn run test:cli
dependsOn: env
- stage: lint
jobs:
- job: packages
steps:
- script: yarn install
displayName: 'Install'
- script: yarn run lint
dependsOn: env