mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
204d2e342a
* test: ui test use secret and include branch * fix argos token
98 lines
3.7 KiB
YAML
98 lines
3.7 KiB
YAML
name: Ant Design
|
|
|
|
trigger:
|
|
branches:
|
|
include:
|
|
- master
|
|
- feature
|
|
|
|
# https://developercommunity.visualstudio.com/comments/949241/view.html
|
|
pr:
|
|
autoCancel: true
|
|
branches:
|
|
exclude:
|
|
- gh-pages
|
|
|
|
pool:
|
|
vmImage: 'ubuntu-latest'
|
|
|
|
stages:
|
|
- stage: site
|
|
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
|
jobs:
|
|
- job: Build_Site
|
|
steps:
|
|
- checkout: self
|
|
displayName: 'Checkout'
|
|
clean: true
|
|
fetchDepth: 1
|
|
- task: NodeTool@0
|
|
displayName: 'Install Node.js'
|
|
inputs:
|
|
versionSpec: '14.7.0'
|
|
- script: npm install
|
|
displayName: 'Install modules'
|
|
- script: |
|
|
node ./scripts/azure-github-comment.js "[![Prepare preview](https://user-images.githubusercontent.com/5378891/72351368-2c979e00-371b-11ea-9652-eb4e825d745e.gif)](https://dev.azure.com/ant-design/ant-design/_build/results?buildId=$(Build.BuildId))"
|
|
displayName: 'Comment on github'
|
|
- script: npm run site
|
|
displayName: 'Build sites'
|
|
- script: ls -al _site/
|
|
displayName: 'List build'
|
|
- script: |
|
|
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ant-design.surge.sh
|
|
echo "Deploy to $DEPLOY_DOMAIN"
|
|
npx surge --project ./_site --domain $DEPLOY_DOMAIN
|
|
displayName: 'Deploy Site'
|
|
- script: |
|
|
export DEPLOY_DOMAIN=https://preview-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}-ant-design.surge.sh
|
|
node ./scripts/azure-github-comment.js "[<img width="306" src="https://user-images.githubusercontent.com/5378891/72400743-23dbb200-3785-11ea-9d13-1a2d92743846.png">]($DEPLOY_DOMAIN)"
|
|
displayName: 'Update comment on github'
|
|
- job: Build_Site_Failed
|
|
dependsOn: Build_Site
|
|
condition: failed()
|
|
steps:
|
|
- checkout: self
|
|
displayName: 'Checkout'
|
|
clean: true
|
|
fetchDepth: 1
|
|
- task: NodeTool@0
|
|
displayName: 'Install Node.js'
|
|
inputs:
|
|
versionSpec: '14.7.0'
|
|
- script: npm install
|
|
displayName: 'Install modules'
|
|
- script: |
|
|
node ./scripts/azure-github-comment.js "[<img width="534" src="https://user-images.githubusercontent.com/5378891/75333447-1e63a280-58c1-11ea-975d-235367fd1522.png">](https://dev.azure.com/ant-design/ant-design/_build/results?buildId=$(Build.BuildId))"
|
|
displayName: 'Comment on github'
|
|
|
|
- stage: ui
|
|
variables:
|
|
ARGOSTOKEN: $(ARGOS_TOKEN)
|
|
${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/') }}:
|
|
branchName: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
|
|
commitId: $(Build.SourceVersion)
|
|
${{ if startsWith(variables['Build.SourceBranch'], 'refs/pull/') }}:
|
|
branchName: $[ replace(variables['Build.SourceBranch'], 'refs/', '') ]
|
|
commitId: $(System.PullRequest.SourceCommitId)
|
|
dependsOn: []
|
|
jobs:
|
|
- job: UI_Test
|
|
steps:
|
|
- script: |
|
|
echo $(commitId)
|
|
- checkout: self
|
|
displayName: 'Checkout'
|
|
clean: true
|
|
fetchDepth: 1
|
|
- task: NodeTool@0
|
|
displayName: 'Install Node.js'
|
|
inputs:
|
|
versionSpec: '14.7.0'
|
|
- script: npm install
|
|
displayName: 'Install modules'
|
|
- script: npm run test-image
|
|
displayName: 'UI Test'
|
|
- script: npm run argos -- --token $(ARGOSTOKEN) --branch $(branchName) --commit $(commitId)
|
|
displayName: 'Upload to argos-ci'
|