Skip to content

Commit

Permalink
Build from Azure Pipelines (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig authored Sep 6, 2024
1 parent 12f5cb1 commit 4c3347b
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 5 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions azure-pipelines/README.md
Original file line number Diff line number Diff line change
@@ -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.
55 changes: 55 additions & 0 deletions azure-pipelines/playground.yml
Original file line number Diff line number Diff line change
@@ -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"
63 changes: 63 additions & 0 deletions azure-pipelines/pre-release.yml
Original file line number Diff line number Diff line change
@@ -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"
55 changes: 55 additions & 0 deletions azure-pipelines/stable.yml
Original file line number Diff line number Diff line change
@@ -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"
1 change: 0 additions & 1 deletion crates/pet-core/src/os_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<PathBuf>>();
trace!("Env PATH: {:?}", paths);
Expand Down
4 changes: 2 additions & 2 deletions crates/pet-windows-registry/src/environments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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\\{}\\{}",
Expand Down
1 change: 1 addition & 0 deletions crates/pet-windows-store/src/environments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ lazy_static! {
}

#[derive(Default)]
#[allow(dead_code)]
struct PotentialPython {
#[allow(dead_code)]
path: Option<PathBuf>,
Expand Down
2 changes: 1 addition & 1 deletion crates/pet-windows-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Vec<PathBuf>>();
if let Some(environments) = self.find_with_cache() {
for found_env in environments {
Expand Down
1 change: 1 addition & 0 deletions crates/pet/src/locators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ fn find_symlinks(executable: &PathBuf) -> Option<Vec<PathBuf>> {
}

#[cfg(windows)]
#[allow(clippy::ptr_arg)]
fn find_symlinks(_executable: &PathBuf) -> Option<Vec<PathBuf>> {
// In windows we will need to spawn the Python exe and then get the exes.
// Lets wait and see if this is necessary.
Expand Down

0 comments on commit 4c3347b

Please sign in to comment.