forked from IBM-Blockchain/generator-fabric
-
Notifications
You must be signed in to change notification settings - Fork 1
/
azure-pipelines.yml
111 lines (110 loc) · 3.43 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
#
# SPDX-License-Identifier: Apache-2.0
#
---
trigger:
branches:
include:
- master
tags:
include:
- "*"
stages:
- stage: unit_tests
displayName: Unit tests
jobs:
- job: unit_tests
displayName: Unit tests
strategy:
matrix:
Linux:
imageName: "ubuntu-latest"
nodeVersion: "10.x"
macOS:
imageName: "macOS-latest"
nodeVersion: "12.x"
Windows:
imageName: "windows-latest"
nodeVersion: "12.x"
pool:
vmImage: $(imageName)
steps:
- template: azure-templates/unit-tests.yml
parameters:
nodeVersion: $(nodeVersion)
- stage: integration_tests
displayName: Integration tests (v2)
dependsOn: unit_tests
jobs:
- job: chaincode_integration_tests
displayName: Integration tests
strategy:
matrix:
Chaincode_Linux:
tests: chaincode_tests
imageName: "ubuntu-latest"
Contract_Linux:
tests: contract_tests
imageName: "ubuntu-latest"
Private_Contract_Linux:
tests: private_contract_tests
imageName: "ubuntu-latest"
Network_Linux:
tests: network_test
imageName: "ubuntu-latest"
pool:
vmImage: $(imageName)
steps:
- template: azure-templates/integration-tests.yml
parameters:
tests: $(tests)
- stage: publish
displayName: Publish to npm
dependsOn:
- integration_tests
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
jobs:
- job: publish
displayName: Publish to npm
pool:
vmImage: "ubuntu-latest"
steps:
- task: NodeTool@0
inputs:
versionSpec: "10.x"
displayName: Use Node.js 10.x
- script: npm install --no-optional
displayName: Install dependencies
- script: npm install -g npm-cli-login
displayName: Install npm login tool
- script: npm-cli-login -u $(NPM_USER) -p $(NPM_PASS) -e $(NPM_EMAIL)
displayName: Login to npm
- script: npm publish
displayName: Publish to npm
- stage: version_bump
displayName: Version bump
dependsOn: publish
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
jobs:
- job: version_bump
displayName: Version bump
pool:
vmImage: "ubuntu-latest"
steps:
- script: |
set -ex
git config --global user.name $(GITHUB_USER_NAME)
git config --global user.email $(GITHUB_USER_EMAIL)
displayName: Set GitHub user name and email
- script: npm version patch --no-git-tag-version
displayName: Use npm to bump version
- script: |
set -ex
VERSION=$(jq -r ".version" package.json)
git commit -asm "Automatic version bump to ${VERSION}"
displayName: Commit version bump
- script: |
set -ex
export branch_name=master
git -c http.extraheader="Authorization: Basic $(GITHUB_BASIC_AUTH)" push $(Build.Repository.Uri) HEAD:$branch_name -f
displayName: Push commit to GitHub