product-build-darwin.yml 7.4 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
build  
Joao Moreno 已提交
47 48 49 50

    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
J
Joao Moreno 已提交
51
    echo "$(macos-developer-certificate)" | base64 -D > $(agent.tempdirectory)/cert.p12
J
build  
Joao Moreno 已提交
52 53
    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 已提交
54 55 56 57
  displayName: Prepare tooling

- script: |
    set -e
J
Joao Moreno 已提交
58 59 60
    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 已提交
61
  displayName: Merge distro
J
Joao Moreno 已提交
62

J
Joao Moreno 已提交
63 64
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
  inputs:
65
    keyfile: 'build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
J
Joao Moreno 已提交
66 67
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'
J
Joao Moreno 已提交
68

J
Joao Moreno 已提交
69 70
- script: |
    set -e
J
Joao Moreno 已提交
71
    CHILD_CONCURRENCY=1 yarn --frozen-lockfile
J
Joao Moreno 已提交
72
  displayName: Install dependencies
J
Joao Moreno 已提交
73
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
74

J
Joao Moreno 已提交
75 76
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
  inputs:
77
    keyfile: 'build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
J
Joao Moreno 已提交
78 79 80
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
81 82 83

- script: |
    set -e
J
Joao Moreno 已提交
84 85 86
    yarn postinstall
  displayName: Run postinstall scripts
  condition: and(succeeded(), eq(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
87

J
Joao Moreno 已提交
88 89
- script: |
    set -e
J
Joao Moreno 已提交
90
    node build/azure-pipelines/mixin
J
Joao Moreno 已提交
91
  displayName: Mix in quality
J
Joao Moreno 已提交
92

L
Logan Ramos 已提交
93 94
- script: |
    set -e
J
Joao Moreno 已提交
95
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
Joao Moreno 已提交
96
      yarn gulp vscode-darwin-min-ci
J
Joao Moreno 已提交
97
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
Joao Moreno 已提交
98
      yarn gulp vscode-reh-darwin-min-ci
J
Joao Moreno 已提交
99
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
B
Benjamin Pasero 已提交
100
      yarn gulp vscode-reh-web-darwin-min-ci
J
Joao Moreno 已提交
101
  displayName: Build
J
Joao Moreno 已提交
102

J
Joao Moreno 已提交
103 104 105 106 107 108
- script: |
    set -e
    ./scripts/test.sh --build --tfs "Unit Tests"
    # APP_NAME="`ls $(agent.builddirectory)/VSCode-darwin | head -n 1`"
    # yarn smoketest -- --build "$(agent.builddirectory)/VSCode-darwin/$APP_NAME"
  displayName: Run unit tests
J
Joao Moreno 已提交
109
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
J
Joao Moreno 已提交
110

D
Daniel Imms 已提交
111
- script: |
B
Benjamin Pasero 已提交
112 113 114
    # 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 已提交
115
    set -e
116 117 118
    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" \
119
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-darwin" \
D
Daniel Imms 已提交
120 121
    ./scripts/test-integration.sh --build --tfs "Integration Tests"
  displayName: Run integration tests
J
Joao Moreno 已提交
122
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
D
Daniel Imms 已提交
123

124 125 126 127 128 129 130 131 132 133
- script: |
    set -e
    cd test/smoke
    yarn compile
    cd -
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-darwin" \
    yarn smoketest --web --headless
  continueOnError: true
  displayName: Run web smoke tests
  condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
134

J
build  
Joao Moreno 已提交
135 136
- script: |
    set -e
J
Joao Moreno 已提交
137
    codesign -s 99FM488X57 --deep --force --options runtime --entitlements build/azure-pipelines/darwin/entitlements.plist $(agent.builddirectory)/VSCode-darwin/*.app
J
build  
Joao Moreno 已提交
138 139
  displayName: Set Hardened Entitlements

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

J
Joao Moreno 已提交
145 146 147 148 149 150 151 152 153 154 155
- 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 已提交
156 157 158 159 160 161
          "parameters": [
            {
              "parameterName": "Hardening",
              "parameterValue": "--options=runtime"
            }
          ],
J
Joao Moreno 已提交
162 163 164 165
          "toolName": "sign",
          "toolVersion": "1.0"
        }
      ]
J
Joao Moreno 已提交
166
    SessionTimeout: 60
J
Joao Moreno 已提交
167
  displayName: Codesign
J
Joao Moreno 已提交
168

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

J
Joao Moreno 已提交
173 174
- script: |
    APP_ROOT=$(agent.builddirectory)/VSCode-darwin
J
build  
Joao Moreno 已提交
175
    APP_NAME="`ls $APP_ROOT | head -n 1`"
J
Joao Moreno 已提交
176 177 178
    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 已提交
179

J
Joao Moreno 已提交
180 181 182 183 184 185 186 187 188 189 190 191 192 193
- 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 已提交
194
              "parameterValue": "$(BundleIdentifier)"
J
Joao Moreno 已提交
195 196 197 198 199 200 201 202
            }
          ],
          "toolName": "sign",
          "toolVersion": "1.0"
        }
      ]
    SessionTimeout: 120
  displayName: Notarization
J
Joao Moreno 已提交
203

J
Joao Moreno 已提交
204 205 206 207 208 209 210 211 212
- 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
213

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