Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,56 @@ jobs:
PREFIX_DEV_READ_ONLY_TOKEN: ${{ secrets.PREFIX_DEV_READ_ONLY_TOKEN }}
S3_ACCESS_KEY_ID: ${{ secrets.S3_UPLOAD_ACCESS_KEY_ID }}
S3_SECRET_ACCESS_KEY: ${{ secrets.S3_UPLOAD_ACCESS_KEY_SECRET }}
- name: Stage x64 release binary
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$binary = Get-ChildItem target-pixi -Recurse -Filter rattler-build.exe |
Where-Object { $_.DirectoryName -match "\\release$" } |
Select-Object -First 1
if ($null -eq $binary) {
throw "Could not find the x64 release binary."
}
New-Item -ItemType Directory -Path staging | Out-Null
Copy-Item $binary.FullName staging/rattler-build.exe
- name: Upload x64 release binary
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v4.4.0
with:
name: rattler-build-windows-x64-e2e
path: staging/rattler-build.exe
if-no-files-found: error
- name: Show sccache stats
if: always()
run: pixi run sccache --show-stats

windows-arm-e2e-test:
name: End-to-end (windows-11-arm)
needs: e2e-test
# e2e-test is a matrix job. Run this when another platform fails, provided
# the workflow itself was not cancelled, so an unrelated failure does not
# skip validation of the successfully uploaded Windows x64 binary.
if: ${{ always() && !cancelled() }}
runs-on: windows-11-arm
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
persist-credentials: false
- uses: prefix-dev/setup-pixi@a09b6247153796b190642a2b53fac4241043cf6f # v0.10.0
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
- name: Download x64 release binary
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: rattler-build-windows-x64-e2e
path: bin
- name: Run Windows architecture E2E test
run: pixi run --platform win-64 --frozen pytest test/end-to-end/test_windows_architecture_execution.py -v
env:
RATTLER_BUILD_PATH: ${{ github.workspace }}\bin\rattler-build.exe

rebuild-test:
name: Rebuild Test
if: contains(github.event.pull_request.labels.*.name, 'needs-rebuild-tests')
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 25 additions & 4 deletions crates/rattler_build_core/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ pub fn os_vars(
prefix: &Path,
target_platform: &Platform,
host_platform: &Platform,
build_platform: &Platform,
env_isolation: EnvironmentIsolation,
work_dir: &Path,
) -> HashMap<String, Option<String>> {
Expand Down Expand Up @@ -260,13 +261,12 @@ pub fn os_vars(
env_isolation,
));
}
let build_platform = Platform::current();
if build_platform.is_windows() {
vars.extend(windows::env::default_env_vars_build(&build_platform));
vars.extend(windows::env::default_env_vars_build(build_platform));
} else if build_platform.is_osx() {
vars.extend(macos::env::default_env_vars_build(&build_platform));
vars.extend(macos::env::default_env_vars_build(build_platform));
} else if build_platform.is_linux() {
vars.extend(linux::env::default_env_vars_build(&build_platform));
vars.extend(linux::env::default_env_vars_build(build_platform));
}

if build_platform.is_windows() {
Expand Down Expand Up @@ -502,6 +502,7 @@ mod test {
prefix,
&Platform::NoArch,
&Platform::Win64,
&Platform::Win64,
EnvironmentIsolation::Strict,
work_dir,
);
Expand All @@ -516,6 +517,25 @@ mod test {
);
}

#[test]
fn build_vars_follow_configured_build_platform() {
let vars = os_vars(
Path::new("/some/prefix"),
&Platform::WinArm64,
&Platform::WinArm64,
&Platform::WinArm64,
EnvironmentIsolation::Strict,
Path::new("/some/work"),
);

let expected =
std::env::var("BUILD").unwrap_or_else(|_| "arm64-pc-windows-19.0.0".to_string());
assert_eq!(
vars.get("BUILD").and_then(|value| value.as_deref()),
Some(expected.as_str())
);
}

/// noarch on a non-Windows host does not emit Windows target vars.
#[test]
fn test_noarch_non_windows_host_has_no_windows_vars() {
Expand All @@ -526,6 +546,7 @@ mod test {
prefix,
&Platform::NoArch,
&Platform::Linux64,
&Platform::Linux64,
EnvironmentIsolation::Strict,
work_dir,
);
Expand Down
Loading