|
| 1 | +# Copyright (c) Microsoft Corporation. |
| 2 | +# Licensed under the MIT License. |
| 3 | + |
| 4 | +name: $(Date:yyyyMMdd)$(Rev:.r).0-$(SourceBranchName) |
| 5 | + |
| 6 | +pr: |
| 7 | + - master |
| 8 | + - dev |
| 9 | + |
| 10 | +trigger: |
| 11 | + branches: |
| 12 | + include: |
| 13 | + - master |
| 14 | + - dev |
| 15 | + tags: |
| 16 | + include: |
| 17 | + - v* |
| 18 | + |
| 19 | +pool: |
| 20 | + name: VSEngSS-MicroBuild2019-1ES |
| 21 | + |
| 22 | +steps: |
| 23 | + # Run these scanners first so that they don't detect issues in dependencies. |
| 24 | + # Failures won't break the build until "Check for compliance errors" step. |
| 25 | + - task: CredScan@2 |
| 26 | + displayName: Run CredScan |
| 27 | + inputs: |
| 28 | + toolMajorVersion: V2 |
| 29 | + - task: PoliCheck@1 |
| 30 | + displayName: Run PoliCheck |
| 31 | + inputs: |
| 32 | + targetType: F |
| 33 | + targetArgument: $(Build.SourcesDirectory) |
| 34 | + |
| 35 | + # Node 14 matches the version of Node used by VS Code when this was written, |
| 36 | + # but it should be updated when VS Code updates its Node version. |
| 37 | + - task: NodeTool@0 |
| 38 | + displayName: Use Node 14.x |
| 39 | + inputs: |
| 40 | + versionSpec: 14.x |
| 41 | + - script: npm install --global gulp node-gyp vsce |
| 42 | + displayName: Install global dependencies |
| 43 | + - script: npm install |
| 44 | + displayName: Install project dependencies |
| 45 | + |
| 46 | + - script: gulp tslint |
| 47 | + displayName: Check for linting errors |
| 48 | + - script: gulp genAikey |
| 49 | + displayName: Use production AI key |
| 50 | + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags')) |
| 51 | + - script: vsce package --out vscode-arduino.vsix |
| 52 | + displayName: Build and pack extension |
| 53 | + - publish: vscode-arduino.vsix |
| 54 | + artifact: VS Code extension VSIX |
| 55 | + displayName: Publish extension VSIX as artifact |
| 56 | + |
| 57 | + - task: ComponentGovernanceComponentDetection@0 |
| 58 | + displayName: Detect components |
| 59 | + |
| 60 | + # Install the Arduino IDE and run tests. |
| 61 | + - script: curl -LO https://downloads.arduino.cc/arduino-1.8.19-windows.zip |
| 62 | + displayName: Download Arduino IDE |
| 63 | + - script: >- |
| 64 | + node --eval "process.exit(require('crypto').createHash('sha256').update( |
| 65 | + require('fs').readFileSync('arduino-1.8.19-windows.zip')).digest('hex') |
| 66 | + == 'c704a821089eab2588f1deae775916219b1517febd1dd574ff29958dca873945' |
| 67 | + ? 0 : 1)" |
| 68 | + displayName: Verify Arduino IDE |
| 69 | + - task: ExtractFiles@1 |
| 70 | + displayName: Extract Arduino IDE |
| 71 | + inputs: |
| 72 | + archiveFilePatterns: arduino-1.8.19-windows.zip |
| 73 | + destinationFolder: arduino-ide |
| 74 | + - script: "echo ##vso[task.prependpath]$(Build.SourcesDirectory)\\arduino-ide\\arduino-1.8.19" |
| 75 | + displayName: Add Arduino IDE to PATH |
| 76 | + - script: npm test --silent |
| 77 | + displayName: Run tests |
| 78 | + |
| 79 | + - task: PostAnalysis@1 |
| 80 | + displayName: Check for compliance errors |
| 81 | + # To avoid spirious warnings about missing logs, explicitly declare what we scanned. |
| 82 | + inputs: |
| 83 | + CredScan: true |
| 84 | + PoliCheck: true |
| 85 | + |
| 86 | + # Trust Services Automation (TSA) can automatically open bugs for compliance issues. |
| 87 | + # https://www.1eswiki.com/wiki/Trust_Services_Automation_(TSA) |
| 88 | + - task: TSAUpload@1 |
| 89 | + displayName: Upload logs to TSA |
| 90 | + inputs: |
| 91 | + tsaVersion: TsaV2 |
| 92 | + codebase: NewOrUpdate |
| 93 | + codeBaseName: vscode-arduino |
| 94 | + notificationAlias: [email protected] |
| 95 | + instanceUrlForTsaV2: DEVDIV |
| 96 | + projectNameDEVDIV: DevDiv |
| 97 | + areaPath: DevDiv\Cpp Developer Experience\Cross Platform\Embedded |
| 98 | + iterationPath: DevDiv |
| 99 | + # To avoid spurious warnings about missing logs, explicitly declare what we don't upload. |
| 100 | + uploadAPIScan: false |
| 101 | + uploadBinSkim: false |
| 102 | + uploadFortifySCA: false |
| 103 | + uploadFxCop: false |
| 104 | + uploadModernCop: false |
| 105 | + uploadPREfast: false |
| 106 | + uploadRoslyn: false |
| 107 | + uploadTSLint: false |
| 108 | + # Don't open bugs for PR builds |
| 109 | + condition: ne(variables['Build.Reason'], 'PullRequest') |
| 110 | + |
| 111 | + - task: GitHubRelease@0 |
| 112 | + displayName: Publish to GitHub |
| 113 | + inputs: |
| 114 | + gitHubConnection: embeddedbot |
| 115 | + repositoryName: microsoft/vscode-arduino |
| 116 | + action: create |
| 117 | + target: $(Build.SourceVersion) |
| 118 | + tagSource: auto |
| 119 | + assets: $(Build.SourcesDirectory)\vscode-arduino.vsix |
| 120 | + isPreRelease: $[contains(variables['Build.SourceBranch'], '-rc')] |
| 121 | + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags')) |
0 commit comments