From 43742d891d51f46009a31bf618f897dd0ed44a6c Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Wed, 7 Jun 2023 15:48:55 -0700 Subject: [PATCH] Run a lint build of the CLI in CI (#184545) * cli: adopt sccache for speedier cli compilations * only cache common linux x64 build * instead, only dev compile/clippy lint in ci --- .../cli/cli-compile-and-publish.yml | 91 +++++++++++-------- .../darwin/cli-build-darwin.yml | 5 + .../azure-pipelines/linux/cli-build-linux.yml | 6 ++ build/azure-pipelines/product-build.yml | 3 + .../azure-pipelines/win32/cli-build-win32.yml | 6 ++ 5 files changed, 71 insertions(+), 40 deletions(-) diff --git a/build/azure-pipelines/cli/cli-compile-and-publish.yml b/build/azure-pipelines/cli/cli-compile-and-publish.yml index 5025994f3a2..004eda0c56a 100644 --- a/build/azure-pipelines/cli/cli-compile-and-publish.yml +++ b/build/azure-pipelines/cli/cli-compile-and-publish.yml @@ -6,42 +6,36 @@ parameters: - name: VSCODE_CLI_ENV type: object default: {} + - name: VSCODE_CHECK_ONLY + type: boolean steps: - - script: cargo build --release --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code - displayName: Compile ${{ parameters.VSCODE_CLI_TARGET }} - workingDirectory: $(Build.SourcesDirectory)/cli - env: - CARGO_NET_GIT_FETCH_WITH_CLI: true - ${{ each pair in parameters.VSCODE_CLI_ENV }}: - ${{ pair.key }}: ${{ pair.value }} - - - ${{ if contains(parameters.VSCODE_CLI_TARGET, '-windows-') }}: - - powershell: | - . build/azure-pipelines/win32/exec.ps1 - $ErrorActionPreference = "Stop" - Move-Item -Path $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code.exe -Destination "$(Build.ArtifactStagingDirectory)/${env:VSCODE_CLI_APPLICATION_NAME}.exe" - - - task: ArchiveFiles@2 - inputs: - rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME).exe - includeRootFolder: false - archiveType: zip - archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip - - - publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip - artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }} - displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact - + - ${{ if parameters.VSCODE_CHECK_ONLY }}: + - script: cargo clippy --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code + displayName: Lint ${{ parameters.VSCODE_CLI_TARGET }} + workingDirectory: $(Build.SourcesDirectory)/cli + env: + CARGO_NET_GIT_FETCH_WITH_CLI: true + ${{ each pair in parameters.VSCODE_CLI_ENV }}: + ${{ pair.key }}: ${{ pair.value }} - ${{ else }}: - - script: | - set -e - mv $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME) + - script: cargo build --release --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code + displayName: Compile ${{ parameters.VSCODE_CLI_TARGET }} + workingDirectory: $(Build.SourcesDirectory)/cli + env: + CARGO_NET_GIT_FETCH_WITH_CLI: true + ${{ each pair in parameters.VSCODE_CLI_ENV }}: + ${{ pair.key }}: ${{ pair.value }} + + - ${{ if contains(parameters.VSCODE_CLI_TARGET, '-windows-') }}: + - powershell: | + . build/azure-pipelines/win32/exec.ps1 + $ErrorActionPreference = "Stop" + Move-Item -Path $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code.exe -Destination "$(Build.ArtifactStagingDirectory)/${env:VSCODE_CLI_APPLICATION_NAME}.exe" - - ${{ if contains(parameters.VSCODE_CLI_TARGET, '-darwin') }}: - task: ArchiveFiles@2 inputs: - rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME) + rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME).exe includeRootFolder: false archiveType: zip archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip @@ -51,14 +45,31 @@ steps: displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact - ${{ else }}: - - task: ArchiveFiles@2 - inputs: - rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME) - includeRootFolder: false - archiveType: tar - tarCompression: gz - archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz + - script: | + set -e + mv $(Build.SourcesDirectory)/cli/target/${{ parameters.VSCODE_CLI_TARGET }}/release/code $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME) - - publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz - artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }} - displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact + - ${{ if contains(parameters.VSCODE_CLI_TARGET, '-darwin') }}: + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME) + includeRootFolder: false + archiveType: zip + archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip + + - publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.zip + artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }} + displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact + + - ${{ else }}: + - task: ArchiveFiles@2 + inputs: + rootFolderOrFile: $(Build.ArtifactStagingDirectory)/$(VSCODE_CLI_APPLICATION_NAME) + includeRootFolder: false + archiveType: tar + tarCompression: gz + archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz + + - publish: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz + artifact: ${{ parameters.VSCODE_CLI_ARTIFACT }} + displayName: Publish ${{ parameters.VSCODE_CLI_ARTIFACT }} artifact diff --git a/build/azure-pipelines/darwin/cli-build-darwin.yml b/build/azure-pipelines/darwin/cli-build-darwin.yml index 550bd36c505..8d98f0e93aa 100644 --- a/build/azure-pipelines/darwin/cli-build-darwin.yml +++ b/build/azure-pipelines/darwin/cli-build-darwin.yml @@ -7,6 +7,9 @@ parameters: - name: VSCODE_BUILD_MACOS_ARM64 type: boolean default: false + - name: VSCODE_CHECK_ONLY + type: boolean + default: false steps: - task: NodeTool@0 @@ -51,6 +54,7 @@ steps: parameters: VSCODE_CLI_TARGET: x86_64-apple-darwin VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_darwin_x64_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-osx/lib OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-osx/include @@ -60,6 +64,7 @@ steps: parameters: VSCODE_CLI_TARGET: aarch64-apple-darwin VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_darwin_arm64_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-osx/lib OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-osx/include diff --git a/build/azure-pipelines/linux/cli-build-linux.yml b/build/azure-pipelines/linux/cli-build-linux.yml index c7e254fe80a..4df126682cf 100644 --- a/build/azure-pipelines/linux/cli-build-linux.yml +++ b/build/azure-pipelines/linux/cli-build-linux.yml @@ -8,6 +8,9 @@ parameters: - name: VSCODE_BUILD_LINUX_ARMHF type: boolean default: false + - name: VSCODE_CHECK_ONLY + type: boolean + default: false - name: VSCODE_QUALITY type: string @@ -64,6 +67,7 @@ steps: parameters: VSCODE_CLI_TARGET: aarch64-unknown-linux-gnu VSCODE_CLI_ARTIFACT: vscode_cli_linux_arm64_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-linux/lib @@ -74,6 +78,7 @@ steps: parameters: VSCODE_CLI_TARGET: x86_64-unknown-linux-gnu VSCODE_CLI_ARTIFACT: vscode_cli_linux_x64_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-linux/lib OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-linux/include @@ -83,6 +88,7 @@ steps: parameters: VSCODE_CLI_TARGET: armv7-unknown-linux-gnueabihf VSCODE_CLI_ARTIFACT: vscode_cli_linux_armhf_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm-linux/lib diff --git a/build/azure-pipelines/product-build.yml b/build/azure-pipelines/product-build.yml index 5be7f43abf1..235e1656209 100644 --- a/build/azure-pipelines/product-build.yml +++ b/build/azure-pipelines/product-build.yml @@ -176,6 +176,7 @@ stages: steps: - template: ./linux/cli-build-linux.yml parameters: + VSCODE_CHECK_ONLY: ${{ variables.VSCODE_CIBUILD }} VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }} VSCODE_BUILD_LINUX: ${{ parameters.VSCODE_BUILD_LINUX }} @@ -216,6 +217,7 @@ stages: steps: - template: ./darwin/cli-build-darwin.yml parameters: + VSCODE_CHECK_ONLY: ${{ variables.VSCODE_CIBUILD }} VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }} VSCODE_BUILD_MACOS: ${{ parameters.VSCODE_BUILD_MACOS }} @@ -235,6 +237,7 @@ stages: steps: - template: ./win32/cli-build-win32.yml parameters: + VSCODE_CHECK_ONLY: ${{ variables.VSCODE_CIBUILD }} VSCODE_QUALITY: ${{ variables.VSCODE_QUALITY }} VSCODE_BUILD_WIN32: ${{ parameters.VSCODE_BUILD_WIN32 }} diff --git a/build/azure-pipelines/win32/cli-build-win32.yml b/build/azure-pipelines/win32/cli-build-win32.yml index 75461133af0..9a155a0c0be 100644 --- a/build/azure-pipelines/win32/cli-build-win32.yml +++ b/build/azure-pipelines/win32/cli-build-win32.yml @@ -8,6 +8,9 @@ parameters: - name: VSCODE_BUILD_WIN32_ARM64 type: boolean default: false + - name: VSCODE_CHECK_ONLY + type: boolean + default: false - name: VSCODE_QUALITY type: string @@ -55,6 +58,7 @@ steps: parameters: VSCODE_CLI_TARGET: x86_64-pc-windows-msvc VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_win32_x64_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-windows-static-md/lib OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x64-windows-static-md/include @@ -65,6 +69,7 @@ steps: parameters: VSCODE_CLI_TARGET: aarch64-pc-windows-msvc VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_win32_arm64_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-windows-static-md/lib OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/arm64-windows-static-md/include @@ -75,6 +80,7 @@ steps: parameters: VSCODE_CLI_TARGET: i686-pc-windows-msvc VSCODE_CLI_ARTIFACT: unsigned_vscode_cli_win32_ia32_cli + VSCODE_CHECK_ONLY: ${{ parameters.VSCODE_CHECK_ONLY }} VSCODE_CLI_ENV: OPENSSL_LIB_DIR: $(Build.ArtifactStagingDirectory)/openssl/x86-windows-static-md/lib OPENSSL_INCLUDE_DIR: $(Build.ArtifactStagingDirectory)/openssl/x86-windows-static-md/include