Skip to content

Commit 43742d8

Browse files
authored
Run a lint build of the CLI in CI (microsoft#184545)
* cli: adopt sccache for speedier cli compilations * only cache common linux x64 build * instead, only dev compile/clippy lint in ci
1 parent 977ee8c commit 43742d8

File tree

5 files changed

+71
-40
lines changed

5 files changed

+71
-40
lines changed

build/azure-pipelines/cli/cli-compile-and-publish.yml

Lines changed: 51 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,42 +6,36 @@ parameters:
66
- name: VSCODE_CLI_ENV
77
type: object
88
default: {}
9+
- name: VSCODE_CHECK_ONLY
10+
type: boolean
911

1012
steps:
11-
- script: cargo build --release --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code
12-
displayName: Compile ${{ parameters.VSCODE_CLI_TARGET }}
13-
workingDirectory: $(Build.SourcesDirectory)/cli
14-
env:
15-
CARGO_NET_GIT_FETCH_WITH_CLI: true
16-
${{ each pair in parameters.VSCODE_CLI_ENV }}:
17-
${{ pair.key }}: ${{ pair.value }}
18-
19-
- ${{ if contains(parameters.VSCODE_CLI_TARGET, '-windows-') }}:
20-
- powershell: |
21-
. build/azure-pipelines/win32/exec.ps1
22-
$ErrorActionPreference = "Stop"
23-
Move-Item -Path $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code.exe -Destination "$(Build.ArtifactStagingDirectory)/${env:VSCODE_CLI_APPLICATION_NAME}.exe"
24-
25-
- task: ArchiveFiles@2
26-
inputs:
27-
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME).exe
28-
includeRootFolder: false
29-
archiveType: zip
30-
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip
31-
32-
- publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip
33-
artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }}
34-
displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact
35-
13+
- ${{ if parameters.VSCODE_CHECK_ONLY }}:
14+
- script: cargo clippy --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code
15+
displayName: Lint ${{ parameters.VSCODE_CLI_TARGET }}
16+
workingDirectory: $(Build.SourcesDirectory)/cli
17+
env:
18+
CARGO_NET_GIT_FETCH_WITH_CLI: true
19+
${{ each pair in parameters.VSCODE_CLI_ENV }}:
20+
${{ pair.key }}: ${{ pair.value }}
3621
- ${{ else }}:
37-
- script: |
38-
set -e
39-
mv $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME)
22+
- script: cargo build --release --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code
23+
displayName: Compile ${{ parameters.VSCODE_CLI_TARGET }}
24+
workingDirectory: $(Build.SourcesDirectory)/cli
25+
env:
26+
CARGO_NET_GIT_FETCH_WITH_CLI: true
27+
${{ each pair in parameters.VSCODE_CLI_ENV }}:
28+
${{ pair.key }}: ${{ pair.value }}
29+
30+
- ${{ if contains(parameters.VSCODE_CLI_TARGET, '-windows-') }}:
31+
- powershell: |
32+
. build/azure-pipelines/win32/exec.ps1
33+
$ErrorActionPreference = "Stop"
34+
Move-Item -Path $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code.exe -Destination "$(Build.ArtifactStagingDirectory)/${env:VSCODE_CLI_APPLICATION_NAME}.exe"
4035
41-
- ${{ if contains(parameters.VSCODE_CLI_TARGET, '-darwin') }}:
4236
- task: ArchiveFiles@2
4337
inputs:
44-
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME)
38+
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME).exe
4539
includeRootFolder: false
4640
archiveType: zip
4741
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip
@@ -51,14 +45,31 @@ steps:
5145
displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact
5246

5347
- ${{ else }}:
54-
- task: ArchiveFiles@2
55-
inputs:
56-
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME)
57-
includeRootFolder: false
58-
archiveType: tar
59-
tarCompression: gz
60-
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz
48+
- script: |
49+
set -e
50+
mv $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME)
6151
62-
- publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz
63-
artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }}
64-
displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact
52+
- ${{ if contains(parameters.VSCODE_CLI_TARGET, '-darwin') }}:
53+
- task: ArchiveFiles@2
54+
inputs:
55+
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME)
56+
includeRootFolder: false
57+
archiveType: zip
58+
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip
59+
60+
- publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip
61+
artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }}
62+
displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact
63+
64+
- ${{ else }}:
65+
- task: ArchiveFiles@2
66+
inputs:
67+
rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME)
68+
includeRootFolder: false
69+
archiveType: tar
70+
tarCompression: gz
71+
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz
72+
73+
- publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz
74+
artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }}
75+
displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact

build/azure-pipelines/darwin/cli-build-darwin.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ parameters:
77
- name: VSCODE_BUILD_MACOS_ARM64
88
type: boolean
99
default: false
10+
- name: VSCODE_CHECK_ONLY
11+
type: boolean
12+
default: false
1013

1114
steps:
1215
- task: NodeTool@0
@@ -51,6 +54,7 @@ steps:
5154
parameters:
5255
VSCODE_CLI_TARGET: x86_64-apple-darwin
5356
VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_darwin_x64_cli
57+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
5458
VSCODE_CLI_ENV:
5559
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-osx/lib
5660
OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-osx/include
@@ -60,6 +64,7 @@ steps:
6064
parameters:
6165
VSCODE_CLI_TARGET: aarch64-apple-darwin
6266
VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_darwin_arm64_cli
67+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
6368
VSCODE_CLI_ENV:
6469
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-osx/lib
6570
OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-osx/include

build/azure-pipelines/linux/cli-build-linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ parameters:
88
- name: VSCODE_BUILD_LINUX_ARMHF
99
type: boolean
1010
default: false
11+
- name: VSCODE_CHECK_ONLY
12+
type: boolean
13+
default: false
1114
- name: VSCODE_QUALITY
1215
type: string
1316

@@ -64,6 +67,7 @@ steps:
6467
parameters:
6568
VSCODE_CLI_TARGET: aarch64-unknown-linux-gnu
6669
VSCODE_CLI_ARTIFACT: vscode_cli_linux_arm64_cli
70+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
6771
VSCODE_CLI_ENV:
6872
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
6973
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-linux/lib
@@ -74,6 +78,7 @@ steps:
7478
parameters:
7579
VSCODE_CLI_TARGET: x86_64-unknown-linux-gnu
7680
VSCODE_CLI_ARTIFACT: vscode_cli_linux_x64_cli
81+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
7782
VSCODE_CLI_ENV:
7883
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-linux/lib
7984
OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-linux/include
@@ -83,6 +88,7 @@ steps:
8388
parameters:
8489
VSCODE_CLI_TARGET: armv7-unknown-linux-gnueabihf
8590
VSCODE_CLI_ARTIFACT: vscode_cli_linux_armhf_cli
91+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
8692
VSCODE_CLI_ENV:
8793
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
8894
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm-linux/lib

build/azure-pipelines/product-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ stages:
176176
steps:
177177
- template: ./linux/cli-build-linux.yml
178178
parameters:
179+
VSCODE_CHECK_ONLY: ${{ variables.VSCODE_CIBUILD }}
179180
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
180181
VSCODE_BUILD_LINUX: ${{ parameters.VSCODE_BUILD_LINUX }}
181182

@@ -216,6 +217,7 @@ stages:
216217
steps:
217218
- template: ./darwin/cli-build-darwin.yml
218219
parameters:
220+
VSCODE_CHECK_ONLY: ${{ variables.VSCODE_CIBUILD }}
219221
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
220222
VSCODE_BUILD_MACOS: ${{ parameters.VSCODE_BUILD_MACOS }}
221223

@@ -235,6 +237,7 @@ stages:
235237
steps:
236238
- template: ./win32/cli-build-win32.yml
237239
parameters:
240+
VSCODE_CHECK_ONLY: ${{ variables.VSCODE_CIBUILD }}
238241
VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }}
239242
VSCODE_BUILD_WIN32: ${{ parameters.VSCODE_BUILD_WIN32 }}
240243

build/azure-pipelines/win32/cli-build-win32.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ parameters:
88
- name: VSCODE_BUILD_WIN32_ARM64
99
type: boolean
1010
default: false
11+
- name: VSCODE_CHECK_ONLY
12+
type: boolean
13+
default: false
1114
- name: VSCODE_QUALITY
1215
type: string
1316

@@ -55,6 +58,7 @@ steps:
5558
parameters:
5659
VSCODE_CLI_TARGET: x86_64-pc-windows-msvc
5760
VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_win32_x64_cli
61+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
5862
VSCODE_CLI_ENV:
5963
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-windows-static-md/lib
6064
OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-windows-static-md/include
@@ -65,6 +69,7 @@ steps:
6569
parameters:
6670
VSCODE_CLI_TARGET: aarch64-pc-windows-msvc
6771
VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_win32_arm64_cli
72+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
6873
VSCODE_CLI_ENV:
6974
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-windows-static-md/lib
7075
OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-windows-static-md/include
@@ -75,6 +80,7 @@ steps:
7580
parameters:
7681
VSCODE_CLI_TARGET: i686-pc-windows-msvc
7782
VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_win32_ia32_cli
83+
VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }}
7884
VSCODE_CLI_ENV:
7985
OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x86-windows-static-md/lib
8086
OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x86-windows-static-md/include

0 commit comments

Comments
 (0)