forked from microsoft/cognitive-services-speech-sdk-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.yml
108 lines (102 loc) · 4.27 KB
/
build.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
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
#
trigger:
- master
pr:
- master
resources:
- repo: self
clean: true
jobs:
- job: Build
pool:
name: SkymanWS2019Compliant
timeoutInMinutes: 60
variables:
ArtifactOut: $(Build.ArtifactStagingDirectory)/Out/JavaScript
steps:
- bash: ./ci/check-git-head.sh
displayName: Repository checks
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: Component Detection
condition: >
and(eq(variables['System.CollectionId'], '19422243-19b9-4d85-9ca6-bc961861d287'),
eq(variables['System.DefinitionId'], '7863'),
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
or(eq(variables['Build.Reason'], 'Schedule'), eq(variables['Build.Reason'], 'Manual')))
- bash: npm ci && npm run civersion
displayName: Install packages and set version / SPEECHSDK_SEMVER2NOMETA
- bash: |
F=src/common.speech/RecognizerConfig.ts
[[ -f $F ]] || exit 1
perl -i.bak -p -e 'BEGIN { $c = 0 } $c += s/(?<=const SPEECHSDK_CLIENTSDK_VERSION = ")[^"]*/$(SPEECHSDK_SEMVER2NOMETA)/g; END { die "Patched SPEECHSDK_CLIENTSDK_VERSION $c time(s), expected 1.\n" if $c != 1 }' "$F"
E=$?
rm -f "$F.bak"
git diff
exit $E
displayName: Stamp SPEECHSDK_CLIENTSDK_VERSION
- bash: npm pack
displayName: Build and pack SDK
- bash: "echo '##vso[task.setvariable variable=SPEECHSDK_RUN_TESTS]false'"
condition: or(failed(), canceled())
displayName: Skip tests on build failure
- script: |
RunTests.cmd ^
SpeechSubscriptionKey:$(WestCentralUSKeySkyMan) ^
SpeechRegion:westcentralus ^
LuisSubscriptionKey:$(luis-westus-s0-201809-key1) ^
LuisRegion:westus ^
SpeechTestEndpointId:ec3432b2-8584-4736-865a-556213b9f6fd ^
BotSubscription:$(BotSubscriptionKeyJS) ^
BotRegion:$(BotRegionJS) ^
SpeakerIDSubscriptionKey:$(SpeakerRecognition-WestUS-Key) ^
SpeakerIDRegion:westus ^
ConversationTranscriptionKey:$(ConverstationTranscriptionKeyWestUSOnline) ^
ConversationTranscriptionRegion:westus ^
CustomVoiceSubscriptionKey:$(speech-ne-s0-key1) ^
CustomVoiceRegion:northeurope
displayName: Run tests
condition: eq(variables['SPEECHSDK_RUN_TESTS'], 'true')
- task: PublishTestResults@2
displayName: Publish test results
inputs:
testRunner: JUnit
testResultsFiles: 'test-javascript-junit.xml'
condition: eq(variables['SPEECHSDK_RUN_TESTS'], 'true')
- bash: |
set -e
cd tests/packaging
npm ci
npm install ../../microsoft-cognitiveservices-speech-sdk-$SPEECHSDK_SEMVER2NOMETA.tgz
npm run bundle
displayName: Run Test Bundle
condition: eq(variables['SPEECHSDK_RUN_TESTS'], 'true')
- bash: |
set -u -e -o pipefail -x
PACKAGE_BASE=microsoft-cognitiveservices-speech-sdk
PACKAGE_NAME=$PACKAGE_BASE-$SPEECHSDK_SEMVER2NOMETA.tgz
PACKAGE_IN=$PACKAGE_NAME
PACKAGE_OUT="$(ArtifactOut)/npm"
ZIP_OUT="$(ArtifactOut)/SpeechSDK-JavaScript-$SPEECHSDK_SEMVER2NOMETA"
mkdir -p "$PACKAGE_OUT" "$ZIP_OUT"
cp --preserve "$PACKAGE_IN" "$PACKAGE_OUT"
echo SRI hash for microsoft.cognitiveservices.speech.sdk.bundle.js: sha512-"$(openssl dgst -sha512 -binary distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle.js | openssl base64 -A)"
cp --preserve LICENSE REDIST.txt NOTICE.txt distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle.* distrib/browser/microsoft.cognitiveservices.speech.sdk.bundle-min.* distrib/browser/speech-processor.js "$ZIP_OUT"
displayName: Create drop
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: $(ArtifactOut)/SpeechSDK-JavaScript-$(SPEECHSDK_SEMVER2NOMETA)
includeRootFolder: true
archiveType: zip
archiveFile: $(ArtifactOut)/SpeechSDK-JavaScript-$(SPEECHSDK_SEMVER2NOMETA).zip
displayName: Create .zip
- bash: rm -rf "$(ArtifactOut)/SpeechSDK-JavaScript-$(SPEECHSDK_SEMVER2NOMETA)"
displayName: Remove temporary directory
- task: PublishBuildArtifacts@1
displayName: Publish drop
inputs:
PathtoPublish: $(ArtifactOut)
ArtifactName: JavaScript
publishLocation: Container