product-build-linux.yml 7.3 KB
Newer Older
J
Joao Moreno 已提交
1
steps:
J
Joao Moreno 已提交
2 3 4
- script: |
    mkdir -p .build
    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:
R
Robo 已提交
24
    versionSpec: "12.14.1"
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

- task: AzureKeyVault@1
  displayName: 'Azure Key Vault: Get Secrets'
  inputs:
    azureSubscription: 'vscode-builds-subscription'
    KeyVaultName: vscode

- script: |
    set -e
    cat << EOF > ~/.netrc
    machine github.com
    login vscode
    password $(github-distro-mixin-password)
    EOF

    git config user.email "vscode@microsoft.com"
    git config user.name "VSCode"
  displayName: Prepare tooling

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

J
João Moreno 已提交
55 56 57 58
- script: |
    echo -n $VSCODE_ARCH > .build/arch
  displayName: Prepare arch cache flag

J
Joao Moreno 已提交
59 60
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
  inputs:
J
João Moreno 已提交
61
    keyfile: '.build/arch, build/.cachesalt, .yarnrc, remote/.yarnrc, **/yarn.lock, !**/node_modules/**/yarn.lock, !**/.*/**/yarn.lock'
J
Joao Moreno 已提交
62 63
    targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
    vstsFeed: 'npm-vscode'
J
Joao Moreno 已提交
64 65 66

- script: |
    set -e
J
João Moreno 已提交
67
    CHILD_CONCURRENCY=1 npm_config_arch=$(NPM_ARCH) yarn --frozen-lockfile
J
Joao Moreno 已提交
68
  displayName: Install dependencies
J
Joao Moreno 已提交
69
  condition: and(succeeded(), ne(variables['CacheRestored'], 'true'))
J
Joao Moreno 已提交
70

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

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

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

- script: |
    set -e
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
João Moreno 已提交
92
      yarn gulp vscode-linux-$(VSCODE_ARCH)-min-ci
J
Joao Moreno 已提交
93
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
João Moreno 已提交
94
      yarn gulp vscode-reh-linux-$(VSCODE_ARCH)-min-ci
J
Joao Moreno 已提交
95
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
João Moreno 已提交
96
      yarn gulp vscode-reh-web-linux-$(VSCODE_ARCH)-min-ci
J
Joao Moreno 已提交
97 98 99 100 101
  displayName: Build

- script: |
    set -e
    service xvfb start
J
Johannes Rieken 已提交
102
  displayName: Start xvfb
J
João Moreno 已提交
103
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
J
Joao Moreno 已提交
104

J
Johannes Rieken 已提交
105 106
- script: |
    set -e
107
    DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests"
108
  displayName: Run unit tests (Electron)
J
João Moreno 已提交
109
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
J
Joao Moreno 已提交
110

B
Benjamin Pasero 已提交
111 112
- script: |
    set -e
113
    DISPLAY=:10 yarn test-browser --build --browser chromium --tfs "Browser Unit Tests"
B
Benjamin Pasero 已提交
114
  displayName: Run unit tests (Browser)
J
João Moreno 已提交
115
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
116

J
Johannes Rieken 已提交
117
- script: |
B
Benjamin Pasero 已提交
118 119 120
    # 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.
J
Johannes Rieken 已提交
121
    set -e
J
João Moreno 已提交
122
    APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
123 124
    APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
    INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
J
João Moreno 已提交
125
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
J
Johannes Rieken 已提交
126
    DISPLAY=:10 ./scripts/test-integration.sh --build --tfs "Integration Tests"
127
  displayName: Run integration tests (Electron)
J
João Moreno 已提交
128
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
129

130 131
- script: |
    set -e
J
João Moreno 已提交
132
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-web-linux-$(VSCODE_ARCH)" \
133 134
    DISPLAY=:10 ./resources/server/test/test-web-integration.sh --browser chromium
  displayName: Run integration tests (Browser)
J
João Moreno 已提交
135
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
136

B
Benjamin Pasero 已提交
137 138
- script: |
    set -e
J
João Moreno 已提交
139
    APP_ROOT=$(agent.builddirectory)/VSCode-linux-$(VSCODE_ARCH)
B
Benjamin Pasero 已提交
140 141
    APP_NAME=$(node -p "require(\"$APP_ROOT/resources/app/product.json\").applicationName")
    INTEGRATION_TEST_ELECTRON_PATH="$APP_ROOT/$APP_NAME" \
J
João Moreno 已提交
142
    VSCODE_REMOTE_SERVER_PATH="$(agent.builddirectory)/vscode-reh-linux-$(VSCODE_ARCH)" \
B
Benjamin Pasero 已提交
143 144
    DISPLAY=:10 ./resources/server/test/test-remote-integration.sh
  displayName: Run remote integration tests (Electron)
J
João Moreno 已提交
145
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
B
Benjamin Pasero 已提交
146

147 148
- task: PublishPipelineArtifact@0
  inputs:
J
João Moreno 已提交
149
    artifactName: 'crash-dump-linux-$(VSCODE_ARCH)'
150 151
    targetPath: .build/crashes
  displayName: 'Publish Crash Reports'
152 153
  continueOnError: true
  condition: failed()
154

155 156 157 158 159 160 161
- task: PublishTestResults@2
  displayName: Publish Tests Results
  inputs:
    testResultsFiles: '*-results.xml'
    searchFolder: '$(Build.ArtifactStagingDirectory)/test-results'
  condition: succeededOrFailed()

162 163
- script: |
    set -e
J
João Moreno 已提交
164 165 166 167 168 169 170 171
    yarn gulp "vscode-linux-$(VSCODE_ARCH)-build-deb"
    yarn gulp "vscode-linux-$(VSCODE_ARCH)-build-rpm"
  displayName: Build deb, rpm packages

- script: |
    set -e
    yarn gulp "vscode-linux-$(VSCODE_ARCH)-prepare-snap"
  displayName: Prepare snap package
J
João Moreno 已提交
172
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
173

D
Daniel Imms 已提交
174 175
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
  inputs:
D
Daniel Imms 已提交
176
    ConnectedServiceName: 'ESRP CodeSign'
J
João Moreno 已提交
177
    FolderPath: '.build/linux/rpm'
D
Daniel Imms 已提交
178
    Pattern: '*.rpm'
D
Daniel Imms 已提交
179 180 181 182
    signConfigType: inlineSignParams
    inlineOperation: |
      [
        {
D
Daniel Imms 已提交
183
          "keyCode": "CP-450779-Pgp",
D
Daniel Imms 已提交
184 185 186 187 188 189 190
          "operationSetCode": "LinuxSign",
          "parameters": [ ],
          "toolName": "sign",
          "toolVersion": "1.0"
        }
      ]
    SessionTimeout: 120
D
Daniel Imms 已提交
191
  displayName: Codesign rpm
D
Daniel Imms 已提交
192

D
Daniel Imms 已提交
193 194 195 196 197
- script: |
    set -e
    AZURE_DOCUMENTDB_MASTERKEY="$(builds-docdb-key-readwrite)" \
    AZURE_STORAGE_ACCESS_KEY_2="$(vscode-storage-key)" \
    VSCODE_MIXIN_PASSWORD="$(github-distro-mixin-password)" \
J
João Moreno 已提交
198
    VSCODE_ARCH="$(VSCODE_ARCH)" \
D
Daniel Imms 已提交
199 200 201
    ./build/azure-pipelines/linux/publish.sh
  displayName: Publish

J
Joao Moreno 已提交
202 203 204
- task: PublishPipelineArtifact@0
  displayName: 'Publish Pipeline Artifact'
  inputs:
J
João Moreno 已提交
205
    artifactName: 'snap-$(VSCODE_ARCH)'
J
Joao Moreno 已提交
206
    targetPath: .build/linux/snap-tarball
J
João Moreno 已提交
207
  condition: and(succeeded(), eq(variables['VSCODE_ARCH'], 'x64'))
J
Joao Moreno 已提交
208 209 210 211

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
  displayName: 'Component Detection'
  continueOnError: true