-
Notifications
You must be signed in to change notification settings - Fork 31
/
azure-pipelines.yml
85 lines (75 loc) · 2.49 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
variables:
NODE_JS_VERSION: 10.15
trigger:
branches:
include:
- master
- azure/*
tags:
include:
- v*
jobs:
- job: test
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- script: |
whoami
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-4.8 g++-4.8
displayName: 'install ubuntu packages'
- script: npm install
displayName: 'npm install'
- script: npm run lint
displayName: 'lint'
- script: |
npx istanbul cover --include-all-sources --root ./src ./node_modules/mocha/bin/_mocha test/unit/ --report cobertura -- -R min
displayName: 'istanbul coverage'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage'
- job: tag
displayName: build tag
dependsOn:
- test
steps:
- task: NodeTool@0
inputs:
versionSpec: $(NODE_JS_VERSION)
- bash: |
set -euo pipefail
current_tag=$(git describe --exact-match --tags)
if [[ -n $current_tag ]]; then
echo "${current_tag}"
LATEST_VERSION_REGEX="^[vV]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
DEV_VERSION_REGEX="^[vV]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$"
if [[ $current_tag =~ $LATEST_VERSION_REGEX ]]; then
echo "##vso[task.setvariable variable=npm_tag]latest"
elif [[ $current_tag =~ $DEV_VERSION_REGEX ]]; then
echo "##vso[task.setvariable variable=npm_tag]dev"
else
# we should never get here
echo "tag ${current_tag} doesn't match semver"
echo "##vso[task.setvariable variable=npm_tag]random"
fi
fi
displayName: set npm tag
- task: Npm@1
inputs:
command: 'custom' # Options: install, publish, custom
verbose: true
customCommand: publish --tag $(npm_tag)
customRegistry: 'useNpmrc'
customEndpoint: npmjs-augur-integration
condition: |
and
(
succeeded(),
startsWith(variables['build.sourceBranch'], 'refs/tags/v')
)