Skip to content

Commit

Permalink
Add some initial downstream tests and apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
abkfenris committed Sep 16, 2024
1 parent 8dc6b53 commit 42ccb4f
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 4 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/test_downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,71 @@ jobs:
run: ${{ env.TARGET_RELEASE }}/pixi${{ matrix.arch.extension }} run typecheck-integration
- name: Run integration tests
run: ${{ env.TARGET_RELEASE }}/pixi${{ matrix.arch.extension }} run test-integration-ci

test-export:
name: ${{ matrix.arch.name }} - Export Tests
runs-on: ${{ matrix.arch.os }}
strategy:
fail-fast: false
matrix:
arch:
# Linux
- {
target: x86_64-unknown-linux-musl,
os: ubuntu-20.04,
name: "Linux",
}
# MacOS
- { target: x86_64-apple-darwin, os: macos-13, name: "MacOS-x86" }
- { target: aarch64-apple-darwin, os: macos-14, name: "MacOS-arm" } # macOS-14 is the ARM chipset
# Windows
- {
target: x86_64-pc-windows-msvc,
os: windows-latest,
extension: .exe,
name: "Windows",
}
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: setup micromamba
uses: mamba-org/[email protected]
- name: Download binary from build
uses: actions/download-artifact@v4
with:
name: pixi-${{ matrix.arch.target }}${{ matrix.arch.extension }}
path: pixi_bin
- name: Debug
run: |
pwd
- name: Setup unix binary, add to github path
if: matrix.arch.name != 'Windows'
run: |
mv pixi_bin/pixi-${{ matrix.arch.target }} pixi_bin/pixi
chmod a+x pixi_bin/pixi
echo "$(pwd)/pixi_bin" >> $GITHUB_PATH
- name: Create Directory and Move Executable
if: matrix.arch.name == 'Windows' && matrix.arch.target == 'x86_64-pc-windows-msvc'
run: |
New-Item -ItemType Directory -Force -Path "D:\.pixi"
Move-Item -Path "pixi_bin/pixi-${{ matrix.arch.target }}${{ matrix.arch.extension }}" -Destination "D:\.pixi\pixi.exe"
shell: pwsh
- name: Add to PATH
if: matrix.arch.name == 'Windows' && matrix.arch.target == 'x86_64-pc-windows-msvc'
run: echo "D:\.pixi" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_PATH
shell: pwsh
- name: Verify and Use Executable
if: matrix.arch.name == 'Windows' && matrix.arch.target == 'x86_64-pc-windows-msvc'
run: |
echo "Current PATH: $env:PATH"
pixi --version
shell: pwsh
- name: Help
run: pixi --help
- name: Info
run: pixi info
- name: Install pixi
run: pixi install -v
- name: Test export
shell: bash
run: bash tests/test_export.sh
7 changes: 3 additions & 4 deletions src/cli/project/export/conda_environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@ use crate::project::Environment;
use crate::Project;

#[derive(Debug, Parser)]
#[clap(arg_required_else_help = false)]
pub struct Args {
/// Explicit path to export the environment to
pub output_path: Option<PathBuf>,

/// The platform to render the environment file for.
/// Defaults to the current platform.
/// The platform to render the environment file for.
/// Defaults to the current platform.
#[arg(short, long)]
pub platform: Option<Platform>,

/// The environment to render the environment file for.
/// The environment to render the environment file for.
/// Defaults to the default environment.
#[arg(short, long)]
pub environment: Option<String>,
Expand Down
45 changes: 45 additions & 0 deletions tests/test_export.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Run from the root of the project using `bash tests/test_export.sh`
set -e
echo "Running test_export.sh"

echo "Exporting the export test environment"
pixi project export conda-environment --manifest-path src/cli/project/export/test-data/testenv/pixi.toml | tee test-env.yml
echo "Creating the export test environment with micromamba"
micromamba create -y -f test-env.yml -n export-test
micromamba env list
micromamba env remove -y -n export-test

echo "Exporting an environment.yml with pip extras"
pixi project export conda-environment --manifest-path examples/pypi/pixi.toml | tee test-env-pip-extras.yml
echo "Creating the pip extra test environment with micromamba"
micromamba create -y -f test-env-pip-extras.yml -n export-test-pip-extras
micromamba env list
micromamba env remove -y -n export-test-pip-extras

echo "Export an environment.yml with editable source dependencies"
pixi project export conda-environment --manifest-path examples/pypi-source-deps/pixi.toml | tee test-env-source-deps.yml
echo "Creating the editable source dependencies test environment with micromamba"
micromamba create -y -f test-env-source-deps.yml -n export-test-source-deps
micromamba env list
micromamba env remove -y -n export-test-source-deps

echo "Export an environment.yml with custom pip registry"
pixi project export conda-environment --manifest-path examples/pypi-custom-registry/pixi.toml | tee test-env-custom-registry.yml
echo "Creating the custom pip registry test environment with micromamba"
micromamba create -y -f test-env-custom-registry.yml -n export-test-custom-registry
micromamba env list
micromamba env remove -y -n export-test-custom-registry

echo "Export an environment.yml with pip find links"
pixi project export conda-environment --manifest-path examples/pypi-find-links/pixi.toml | tee test-env-find-links.yml
echo "Creating the pip find links test environment with micromamba"
micromamba create -y -f test-env-find-links.yml -n export-test-find-links
micromamba env list
micromamba env remove -y -n export-test-find-links

echo "Export an environment.yml from a pyproject.toml that has caused panics"
pixi project export conda-environment --manifest-path examples/docker/pyproject.toml | tee test-env-pyproject-panic.yml
echo "Creating the pyproject.toml panic test environment with micromamba"
micromamba create -y -f test-env-pyproject-panic.yml -n export-test-pyproject-panic
micromamba env list
micromamba env remove -y -n export-test-pyproject-panic

0 comments on commit 42ccb4f

Please sign in to comment.