From 4c3347b0efa03d6538110e04d7adb6561332ae3e Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 6 Sep 2024 12:39:08 -0700 Subject: [PATCH] Build from Azure Pipelines (#147) --- Cargo.toml | 4 +- azure-pipelines/README.md | 5 ++ azure-pipelines/playground.yml | 55 ++++++++++++++++ azure-pipelines/pre-release.yml | 63 +++++++++++++++++++ azure-pipelines/stable.yml | 55 ++++++++++++++++ crates/pet-core/src/os_environment.rs | 1 - .../pet-windows-registry/src/environments.rs | 4 +- crates/pet-windows-store/src/environments.rs | 1 + crates/pet-windows-store/src/lib.rs | 2 +- crates/pet/src/locators.rs | 1 + 10 files changed, 186 insertions(+), 5 deletions(-) create mode 100644 azure-pipelines/README.md create mode 100644 azure-pipelines/playground.yml create mode 100644 azure-pipelines/pre-release.yml create mode 100644 azure-pipelines/stable.yml diff --git a/Cargo.toml b/Cargo.toml index 7fabbe05..a902c513 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,9 @@ members = ["crates/*"] resolver = "2" [profile.release] -strip = true +# Enable all optimizations +opt-level = 3 +# Enable full link-time-optimizations lto = true codegen-units = 1 # Enable full debug info for optimized builds. diff --git a/azure-pipelines/README.md b/azure-pipelines/README.md new file mode 100644 index 00000000..de1bea50 --- /dev/null +++ b/azure-pipelines/README.md @@ -0,0 +1,5 @@ +pre-release.yml: This should build from the `main` branch and publish to the Azure Pipeline feed. This will be consumed by extensions that are also doing pre-release builds. Signing is required on this build. + +stable.yml: This should build from the `release/*` branch and publish to the Azure Pipeline feed. This will be consumed by extensions when publishing stable builds. Signing is required on this build. + +playground.yml: This pipeline is for engineering/testing purposes so we can do fixes and tests without affecting the pipeline feeds. This will not publish to the Azure Pipeline feed. Signing is not required on this build. diff --git a/azure-pipelines/playground.yml b/azure-pipelines/playground.yml new file mode 100644 index 00000000..d49182dd --- /dev/null +++ b/azure-pipelines/playground.yml @@ -0,0 +1,55 @@ +trigger: none +pr: none +# Should only ever be manually run. + +resources: + repositories: + - repository: templates + type: github + name: microsoft/vscode-engineering + ref: main + endpoint: Monaco + +extends: + template: azure-pipelines/rust-package/pipeline.yml@templates + parameters: + ghCreateTag: false + binaryName: "pet" + signing: false + buildWasm: false + apiScanSoftwareVersion: 2024 # major version of `pet` for internal reporting + + buildPlatforms: + - name: Linux + vsceTarget: "web" + - name: Linux + packageArch: arm64 + vsceTarget: linux-arm64 + - name: Linux + packageArch: arm + vsceTarget: linux-armhf + - name: Linux + packageArch: x64 + vsceTarget: linux-x64 + - name: Linux + packageArch: arm64 + vsceTarget: alpine-arm64 + - name: Linux + packageArch: x64 + vsceTarget: alpine-x64 + - name: MacOS + packageArch: arm64 + vsceTarget: darwin-arm64 + - name: MacOS + packageArch: x64 + vsceTarget: darwin-x64 + - name: Windows + packageArch: arm + vsceTarget: win32-arm64 + - name: Windows + packageArch: x64 + vsceTarget: win32-x64 + + preBuildSteps: + - pwsh: Rename-Item -Path "./.cargo/config.toml.disabled" -NewName "config.toml" + displayName: "Enable Azure Build config for Rust" diff --git a/azure-pipelines/pre-release.yml b/azure-pipelines/pre-release.yml new file mode 100644 index 00000000..c62c5aee --- /dev/null +++ b/azure-pipelines/pre-release.yml @@ -0,0 +1,63 @@ +# Run on a schedule +trigger: none +pr: none + +schedules: + - cron: "0 10 * * 1-5" # 10AM UTC (2AM PDT) MON-FRI (VS Code Pre-release builds at 9PM PDT) + displayName: Nightly Pre-Release Schedule + always: false # only run if there are source code changes + branches: + include: + - main + +resources: + repositories: + - repository: templates + type: github + name: microsoft/vscode-engineering + ref: main + endpoint: Monaco + +extends: + template: azure-pipelines/rust-package/pipeline.yml@templates + parameters: + ghCreateTag: false + binaryName: "pet" + signing: true + buildWasm: false + apiScanSoftwareVersion: 2024 # major version of `pet` for internal reporting + + buildPlatforms: + - name: Linux + vsceTarget: "web" + - name: Linux + packageArch: arm64 + vsceTarget: linux-arm64 + - name: Linux + packageArch: arm + vsceTarget: linux-armhf + - name: Linux + packageArch: x64 + vsceTarget: linux-x64 + - name: Linux + packageArch: arm64 + vsceTarget: alpine-arm64 + - name: Linux + packageArch: x64 + vsceTarget: alpine-x64 + - name: MacOS + packageArch: arm64 + vsceTarget: darwin-arm64 + - name: MacOS + packageArch: x64 + vsceTarget: darwin-x64 + - name: Windows + packageArch: arm + vsceTarget: win32-arm64 + - name: Windows + packageArch: x64 + vsceTarget: win32-x64 + + preBuildSteps: + - pwsh: Rename-Item -Path "./.cargo/config.toml.disabled" -NewName "config.toml" + displayName: "Enable Azure Build config for Rust" diff --git a/azure-pipelines/stable.yml b/azure-pipelines/stable.yml new file mode 100644 index 00000000..64058ba1 --- /dev/null +++ b/azure-pipelines/stable.yml @@ -0,0 +1,55 @@ +trigger: none +pr: none +# Should only ever be manually run. + +resources: + repositories: + - repository: templates + type: github + name: microsoft/vscode-engineering + ref: main + endpoint: Monaco + +extends: + template: azure-pipelines/rust-package/pipeline.yml@templates + parameters: + ghCreateTag: false + binaryName: "pet" + signing: true + buildWasm: false + apiScanSoftwareVersion: 2024 # major version of `pet` for internal reporting + + buildPlatforms: + - name: Linux + vsceTarget: "web" + - name: Linux + packageArch: arm64 + vsceTarget: linux-arm64 + - name: Linux + packageArch: arm + vsceTarget: linux-armhf + - name: Linux + packageArch: x64 + vsceTarget: linux-x64 + - name: Linux + packageArch: arm64 + vsceTarget: alpine-arm64 + - name: Linux + packageArch: x64 + vsceTarget: alpine-x64 + - name: MacOS + packageArch: arm64 + vsceTarget: darwin-arm64 + - name: MacOS + packageArch: x64 + vsceTarget: darwin-x64 + - name: Windows + packageArch: arm + vsceTarget: win32-arm64 + - name: Windows + packageArch: x64 + vsceTarget: win32-x64 + + preBuildSteps: + - pwsh: Rename-Item -Path "./.cargo/config.toml.disabled" -NewName "config.toml" + displayName: "Enable Azure Build config for Rust" diff --git a/crates/pet-core/src/os_environment.rs b/crates/pet-core/src/os_environment.rs index 6fa0b44f..f9ef61a3 100644 --- a/crates/pet-core/src/os_environment.rs +++ b/crates/pet-core/src/os_environment.rs @@ -50,7 +50,6 @@ impl Environment for EnvironmentApi { if self.global_search_locations.lock().unwrap().is_empty() { let mut paths = env::split_paths(&self.get_env_var("PATH".to_string()).unwrap_or_default()) - .into_iter() .filter(|p| p.exists()) .collect::>(); trace!("Env PATH: {:?}", paths); diff --git a/crates/pet-windows-registry/src/environments.rs b/crates/pet-windows-registry/src/environments.rs index a2139be3..c10cfc34 100644 --- a/crates/pet-windows-registry/src/environments.rs +++ b/crates/pet-windows-registry/src/environments.rs @@ -101,7 +101,7 @@ fn get_registry_pythons_from_key_for_company( Ok(install_path_key) => { let env_path: String = install_path_key.get_value("").ok().unwrap_or_default(); - let env_path = norm_case(&PathBuf::from(env_path)); + let env_path = norm_case(PathBuf::from(env_path)); if is_windows_app_folder_in_program_files(&env_path) { trace!( "Found Python ({}) in {}\\Software\\Python\\{}\\{}, but skipping as this is a Windows Store Python", @@ -144,7 +144,7 @@ fn get_registry_pythons_from_key_for_company( ); continue; } - let executable = norm_case(&PathBuf::from(executable)); + let executable = norm_case(PathBuf::from(executable)); if !executable.exists() { warn!( "Python executable ({}) file not found for {}\\Software\\Python\\{}\\{}", diff --git a/crates/pet-windows-store/src/environments.rs b/crates/pet-windows-store/src/environments.rs index 6955dc8b..2d520e52 100644 --- a/crates/pet-windows-store/src/environments.rs +++ b/crates/pet-windows-store/src/environments.rs @@ -32,6 +32,7 @@ lazy_static! { } #[derive(Default)] +#[allow(dead_code)] struct PotentialPython { #[allow(dead_code)] path: Option, diff --git a/crates/pet-windows-store/src/lib.rs b/crates/pet-windows-store/src/lib.rs index 4d6f70b4..233974c3 100644 --- a/crates/pet-windows-store/src/lib.rs +++ b/crates/pet-windows-store/src/lib.rs @@ -74,7 +74,7 @@ impl Locator for WindowsStore { } let list_of_possible_exes = vec![env.executable.clone()] .into_iter() - .chain(env.symlinks.clone().unwrap_or_default().into_iter()) + .chain(env.symlinks.clone().unwrap_or_default()) .collect::>(); if let Some(environments) = self.find_with_cache() { for found_env in environments { diff --git a/crates/pet/src/locators.rs b/crates/pet/src/locators.rs index 1a6fdd7c..3047217d 100644 --- a/crates/pet/src/locators.rs +++ b/crates/pet/src/locators.rs @@ -200,6 +200,7 @@ fn find_symlinks(executable: &PathBuf) -> Option> { } #[cfg(windows)] +#[allow(clippy::ptr_arg)] fn find_symlinks(_executable: &PathBuf) -> Option> { // In windows we will need to spawn the Python exe and then get the exes. // Lets wait and see if this is necessary.