product-build-darwin.yml 7.5 KB
Newer Older
J
Joao Moreno 已提交
1
steps:
J
Joao Moreno 已提交
2 3
- script: |
    mkdir -p .build
J
Joao Moreno 已提交
4
    echo -n $BUILD_SOURCEVERSION > .build/commit
5
    echo -n $VSCODE_QUALITY > .build/quality
J
Joao Moreno 已提交
6 7 8 9
  displayName: Prepare cache flag

- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
  inputs:
10
    keyfile: 'build/.cachesalt, .build/commit, .build/quality'
11
    targetfolder: '.build, out-build, out-vscode-min, out-vscode-reh-min, out-vscode-reh-web-min'
J
Joao Moreno 已提交
12 13 14 15 16 17 18 19 20 21
    vstsFeed: 'npm-vscode'
    platformIndependent: true
    alias: 'Compilation'

- script: |
    set -e
    exit 1
  displayName: Check RestoreCache
  condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'))

J
Joao Moreno 已提交
22 23
- task: NodeTool@0
  inputs:
24
    versionSpec: "12.13.0"
J
Joao Moreno 已提交
25 26 27

- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
  inputs:
I
isidor 已提交
28
    versionSpec: "1.x"
J
Joao Moreno 已提交
29

J
build  
Joao Moreno 已提交
30 31 32 33 34 35
- task: AzureKeyVault@1
  displayName: 'Azure Key Vault: Get Secrets'
  inputs:
    azureSubscription: 'vscode-builds-subscription'
    KeyVaultName: vscode

J
Joao Moreno 已提交
36 37
- script: |
    set -e
J
Joao Moreno 已提交
38 39 40

    cat << EOF > ~/.netrc
    machine github.com
J
Joao Moreno 已提交
41
    login vscode
J
Joao Moreno 已提交
42
    password $(github-distro-mixin-password)
J
Joao Moreno 已提交
43 44
    EOF

J
Joao Moreno 已提交
45 46
    git config user.email "vscode@microsoft.com"
    git config user.name "VSCode"
J
Joao Moreno 已提交
47 48 49 50
  displayName: Prepare tooling

- script: |
    set -e
J
Joao Moreno 已提交
51 52 53
    git remote add distro "https://github.com/$(VSCODE_MIXIN_REPO).git"
    git fetch distro
    git merge $(node -p "require('./package.json').distro")
J
Joao Moreno 已提交
54
  displayName: Merge distro
J
Joao Moreno 已提交
55

J
Joao Moreno 已提交
56 57
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
  inputs:
58
    keyfile: 'build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
J
Joao Moreno 已提交
59 60
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'
J
Joao Moreno 已提交
61

J
Joao Moreno 已提交
62 63
- script: |
    set -e
J
Joao Moreno 已提交
64
    CHILD_CONCURRENCY=1 yarn --frozen-lockfile
J
Joao Moreno 已提交
65
  displayName: Install dependencies
J
Joao Moreno 已提交
66
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
67

J
Joao Moreno 已提交
68 69
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
  inputs:
70
    keyfile: 'build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
J
Joao Moreno 已提交
71 72 73
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
74 75 76

- script: |
    set -e
J
Joao Moreno 已提交
77 78 79
    yarn postinstall
  displayName: Run postinstall scripts
  condition: and(succeeded(), eq(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
80

J
Joao Moreno 已提交
81 82
- script: |
    set -e
J
Joao Moreno 已提交
83
    node build/azure-pipelines/mixin
J
Joao Moreno 已提交
84
  displayName: Mix in quality
J
Joao Moreno 已提交
85

L
Logan Ramos 已提交
86 87
- script: |
    set -e
J
Joao Moreno 已提交
88
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
Joao Moreno 已提交
89
      yarn gulp vscode-darwin-min-ci
J
Joao Moreno 已提交
90
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
Joao Moreno 已提交
91
      yarn gulp vscode-reh-darwin-min-ci
J
Joao Moreno 已提交
92
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
B
Benjamin Pasero 已提交
93
      yarn gulp vscode-reh-web-darwin-min-ci
J
Joao Moreno 已提交
94
  displayName: Build
J
Joao Moreno 已提交
95

J
Joao Moreno 已提交
96 97 98
- script: |
    set -e
    ./scripts/test.sh --build --tfs "Unit Tests"
99
  displayName: Run unit tests (Electron)
J
Joao Moreno 已提交
100
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
J
Joao Moreno 已提交
101

D
Daniel Imms 已提交
102
- script: |
B
Benjamin Pasero 已提交
103 104 105
    # Figure out the full absolute path of the product we just built
    # including the remote server and configure the integration tests
    # to run with these builds instead of running out of sources.
D
Daniel Imms 已提交
106
    set -e
107 108 109
    APP_ROOT=$(agent.builddirectory)/VSCode-darwin
    APP_NAME="`ls $APP_ROOT | head -n 1`"
    INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME/Contents/MacOS/Electron" \
110
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \
D
Daniel Imms 已提交
111
    ./scripts/test-integration.sh --build --tfs "Integration Tests"
112
  displayName: Run integration tests (Electron)
J
Joao Moreno 已提交
113
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
D
Daniel Imms 已提交
114

115 116 117
- script: |
    set -e
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \
118 119 120 121 122 123 124 125
    ./resources/server/test/test-web-integration.sh --browser webkit
  displayName: Run integration tests (Browser)
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))

- script: |
    set -e
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \
    yarn smoketest --web --headless --browser webkit
126
  continueOnError: true
127
  displayName: Run smoke tests (Browser)
128
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
129

J
build  
Joao Moreno 已提交
130 131
- script: |
    set -e
J
Joao Moreno 已提交
132 133 134 135 136 137
    security create-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
    security default-keychain -s $(agent.tempdirectory)/buildagent.keychain
    security unlock-keychain -p pwd $(agent.tempdirectory)/buildagent.keychain
    echo "$(macos-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12
    security import $(agent.tempdirectory)/cert.p12 -k $(agent.tempdirectory)/buildagent.keychain -P "$(macos-developer-certificate-key)" -T /usr/bin/codesign
    security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain
J
Joao Moreno 已提交
138
    codesign -s 99FM488X57 --deep --force --options runtime --entitlements build/azure-pipelines/darwin/entitlements.plist $(agent.builddirectory)/VSCode-darwin/*.app
J
build  
Joao Moreno 已提交
139 140
  displayName: Set Hardened Entitlements

J
Joao Moreno 已提交
141 142
- script: |
    set -e
J
Joao Moreno 已提交
143
    pushd $(agent.builddirectory)/VSCode-darwin && zip -r -X -y $(agent.builddirectory)/VSCode-darwin.zip * && popd
J
Joao Moreno 已提交
144
  displayName: Archive build
J
Joao Moreno 已提交
145

J
Joao Moreno 已提交
146 147 148 149 150 151 152 153 154 155 156
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
  inputs:
    ConnectedServiceName: 'ESRP CodeSign'
    FolderPath: '$(agent.builddirectory)'
    Pattern: 'VSCode-darwin.zip'
    signConfigType: inlineSignParams
    inlineOperation: |
      [
        {
          "keyCode": "CP-401337-Apple",
          "operationSetCode": "MacAppDeveloperSign",
J
Joao Moreno 已提交
157 158 159 160 161 162
          "parameters": [
            {
              "parameterName": "Hardening",
              "parameterValue": "--options=runtime"
            }
          ],
J
Joao Moreno 已提交
163 164 165 166
          "toolName": "sign",
          "toolVersion": "1.0"
        }
      ]
J
Joao Moreno 已提交
167
    SessionTimeout: 60
J
Joao Moreno 已提交
168
  displayName: Codesign
J
Joao Moreno 已提交
169

J
Joao Moreno 已提交
170
- script: |
J
Joao Moreno 已提交
171
    zip -d $(agent.builddirectory)/VSCode-darwin.zip "*.pkg"
J
Joao Moreno 已提交
172 173
  displayName: Clean Archive

J
Joao Moreno 已提交
174 175
- script: |
    APP_ROOT=$(agent.builddirectory)/VSCode-darwin
J
build  
Joao Moreno 已提交
176
    APP_NAME="`ls $APP_ROOT | head -n 1`"
J
Joao Moreno 已提交
177 178 179
    BUNDLE_IDENTIFIER=$(node -p "require(\"$APP_ROOT/$APP_NAME/Contents/Resources/app/product.json\").darwinBundleIdentifier")
    echo "##vso[task.setvariable variable=BundleIdentifier]$BUNDLE_IDENTIFIER"
  displayName: Export bundle identifier
J
Joao Moreno 已提交
180

J
Joao Moreno 已提交
181 182 183 184 185 186 187 188 189 190 191 192 193 194
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
  inputs:
    ConnectedServiceName: 'ESRP CodeSign'
    FolderPath: '$(agent.builddirectory)'
    Pattern: 'VSCode-darwin.zip'
    signConfigType: inlineSignParams
    inlineOperation: |
      [
        {
          "keyCode": "CP-401337-Apple",
          "operationSetCode": "MacAppNotarize",
          "parameters": [
            {
              "parameterName": "BundleId",
J
Joao Moreno 已提交
195
              "parameterValue": "$(BundleIdentifier)"
J
Joao Moreno 已提交
196 197 198 199 200 201 202 203
            }
          ],
          "toolName": "sign",
          "toolVersion": "1.0"
        }
      ]
    SessionTimeout: 120
  displayName: Notarization
J
Joao Moreno 已提交
204

J
Joao Moreno 已提交
205 206 207 208 209 210 211 212 213
- script: |
    set -e
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
    AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
    AZURE_STORAGE_ACCESS_KEY="$(ticino-storage-key)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
    VSCODE_HOCKEYAPP_TOKEN="$(vscode-hockeyapp-token)" \
    ./build/azure-pipelines/darwin/publish.sh
  displayName: Publish
214

J
Joao Moreno 已提交
215 216 217
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
  displayName: 'Component Detection'
  continueOnError: true