fix issue #141
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test python-setup/pixi | |
| on: | |
| push: | |
| jobs: | |
| test-pixi-basic: | |
| name: Test pixi action - defaults | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-basic/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-basic/pixi.lock . | |
| - name: Test pixi setup with defaults | |
| id: setup | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| cache: "false" | |
| - name: Verify installation | |
| run: | | |
| echo "Testing pixi command..." | |
| pixi --version | |
| echo "Testing Python..." | |
| python --version | |
| echo "Testing installed packages..." | |
| python -c "import numpy; print(f'NumPy version: {numpy.__version__}')" | |
| python -c "import pytest; print(f'Pytest version: {pytest.__version__}')" | |
| test-pixi-default-environment: | |
| name: Test pixi action - Default environment only | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-default-environment/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-default-environment/pixi.lock . | |
| - name: Test pixi action with defaults (should use default environment) | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| cache: "false" | |
| - name: Verify default environment installation | |
| run: | | |
| python --version | |
| python -c "import requests; print('[OK] Default environment installed')" | |
| pixi info | |
| test-pixi-multiple-environments: | |
| name: Test pixi action - Multiple environments | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-multiple-environments/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-multiple-environments/pixi.lock . | |
| - name: Test pixi setup with multiple environments | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| environments: "py311 py312" | |
| activate-environment: "py311" | |
| cache: "false" | |
| - name: Verify active environment | |
| run: | | |
| echo "Current Python version:" | |
| python --version | |
| echo "Testing py311 specific package..." | |
| python -c "import pandas; print(f'Pandas version: {pandas.__version__}')" | |
| - name: List environments | |
| run: | | |
| pixi info | |
| pixi list -e py311 | |
| pixi list -e py312 | |
| test-pixi-environment-activation: | |
| name: Test pixi action - Environment activation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-environment-activation/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-environment-activation/pixi.lock . | |
| - name: Test pixi setup with dev environment activation | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| environments: "prod dev" | |
| activate-environment: "dev" | |
| cache: "false" | |
| - name: Verify dev environment is active | |
| run: | | |
| echo "Testing dev packages..." | |
| python -c "import pytest; print('Pytest available in dev')" | |
| python -c "import black; print('Black available in dev')" | |
| echo "Testing that prod packages are not in dev environment..." | |
| python -c "import flask" 2>/dev/null && echo "ERROR: Flask should not be in dev!" && exit 1 || echo "Good: Flask not in dev environment" | |
| test-pixi-lock-verification-valid: | |
| name: Test pixi action - Lock file verification (valid) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-lock-verification-valid/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-lock-verification-valid/pixi.lock . | |
| - name: Test with valid lock file (should pass) | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| cache: "false" | |
| test-pixi-lock-verification-outdated: | |
| name: Test pixi action - Lock file verification (outdated) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-lock-verification-outdated/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-lock-verification-outdated/pixi.lock . | |
| - name: Modify pyproject.toml to make lock outdated | |
| run: | | |
| cat >> pyproject.toml << 'EOF' | |
| [tool.pixi.dependencies.pandas] | |
| version = ">=2.0" | |
| EOF | |
| - name: Test with outdated lock file (should fail) | |
| id: outdated-lock-test | |
| continue-on-error: true | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| cache: "false" | |
| - name: Verify lock verification failed | |
| if: steps.outdated-lock-test.outcome != 'failure' | |
| run: | | |
| echo "ERROR: Lock verification should have failed with outdated lock file" | |
| exit 1 | |
| test-pixi-lock-verification-disabled: | |
| name: Test pixi action - Lock file verification (disabled) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-lock-verification-disabled/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-lock-verification-disabled/pixi.lock . | |
| - name: Test with verify-lock disabled | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| verify-lock: "false" | |
| cache: "false" | |
| test-pixi-lock-verification-validation: | |
| name: Test pixi action - Lock verification validation (should fail without lock file) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test pyproject.toml (no lock file for this test) | |
| run: | | |
| cp tests/data/pixi/test-pixi-lock-verification-validation/pyproject.toml . | |
| - name: Test verify-lock without lock file (should fail) | |
| id: verify-lock-without-lock | |
| continue-on-error: true | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| verify-lock: "true" | |
| cache: "false" | |
| - name: Verify validation failed | |
| if: steps.verify-lock-without-lock.outcome != 'failure' | |
| run: | | |
| echo "ERROR: Lock verification validation should have failed without lock file" | |
| exit 1 | |
| - name: Verify error message is helpful | |
| if: steps.verify-lock-without-lock.outcome == 'failure' | |
| run: | | |
| echo "✓ Validation correctly failed when verify-lock was enabled without lock file" | |
| test-pixi-caching-populate: | |
| name: Test pixi action - Caching (populate) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-caching-populate/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-caching-populate/pixi.lock . | |
| - name: Run with cache enabled - should populate cache | |
| id: populate-cache | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| cache: "true" | |
| - name: Verify packages are installed | |
| run: | | |
| python -c "import numpy, scipy, matplotlib; print('All packages installed successfully')" | |
| test-pixi-caching-retrieve: | |
| name: Test pixi action - Caching (retrieve) | |
| runs-on: ubuntu-latest | |
| needs: test-pixi-caching-populate | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-caching-retrieve/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-caching-retrieve/pixi.lock . | |
| - name: Run with cache - should retrieve from cache | |
| id: second-run | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| cache: "true" | |
| - name: Verify packages are available from cache | |
| run: | | |
| python -c "import numpy, scipy, matplotlib; print('All packages available from cache')" | |
| test-pixi-caching-validation: | |
| name: Test pixi action - Cache validation (should fail without lock file) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create test pyproject.toml | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "cache-validation-test" | |
| version = "0.1.0" | |
| dependencies = [] | |
| [tool.pixi.workspace] | |
| channels = ["conda-forge"] | |
| platforms = ["linux-64", "osx-64", "osx-arm64", "win-64"] | |
| [tool.pixi.dependencies] | |
| python = ">=3.11" | |
| numpy = ">=1.26" | |
| EOF | |
| - name: Test cache without lock file (should fail) | |
| id: cache-without-lock | |
| continue-on-error: true | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| cache: "true" | |
| - name: Verify validation failed | |
| if: steps.cache-without-lock.outcome != 'failure' | |
| run: | | |
| echo "ERROR: Cache validation should have failed without lock file" | |
| exit 1 | |
| - name: Verify error message is helpful | |
| if: steps.cache-without-lock.outcome == 'failure' | |
| run: | | |
| echo "✓ Validation correctly failed when cache was enabled without lock file" | |
| test-pixi-matrix: | |
| name: Test pixi action - Matrix | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| environment: ["default", "py311", "py312"] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-matrix/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-matrix/pixi.lock . | |
| - name: Test pixi setup | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| environments: ${{ matrix.environment }} | |
| activate-environment: ${{ matrix.environment }} | |
| cache: "false" | |
| - name: Verify Python installation | |
| run: | | |
| python --version | |
| pixi list -e ${{ matrix.environment }} | |
| test-pixi-error-scenarios: | |
| name: Test pixi action - Error scenarios | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Test without lock file (should fail with validation error) | |
| id: no-lock-test | |
| continue-on-error: true | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test" | |
| version = "0.1.0" | |
| dependencies = [] | |
| [tool.pixi.workspace] | |
| channels = ["conda-forge"] | |
| platforms = ["linux-64"] | |
| [tool.pixi.dependencies] | |
| python = ">=3.11" | |
| EOF | |
| # This should fail in the composite action before trying to use pixi | |
| cd ${{ github.workspace }} | |
| - name: Try action without lock file | |
| if: always() | |
| id: action-without-lock | |
| continue-on-error: true | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| verify-lock: "false" | |
| cache: "false" | |
| - name: Verify action failed without lock file | |
| if: steps.action-without-lock.outcome != 'failure' | |
| run: | | |
| echo "ERROR: Action should fail without lock file" | |
| exit 1 | |
| - name: Copy fixture for non-existent environment test | |
| run: | | |
| cp tests/data/pixi/test-pixi-basic/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-basic/pixi.lock . | |
| - name: Test activating non-existent environment | |
| id: nonexistent-env-test | |
| continue-on-error: true | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| activate-environment: "nonexistent" | |
| verify-lock: "false" | |
| cache: "false" | |
| - name: Verify action failed with non-existent environment | |
| if: steps.nonexistent-env-test.outcome != 'failure' | |
| run: | | |
| echo "ERROR: Action should fail when activating non-existent environment" | |
| exit 1 | |
| test-pixi-complex-project: | |
| name: Test pixi action - Complex project setup | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Copy test fixture files | |
| run: | | |
| cp tests/data/pixi/test-pixi-complex-project/pyproject.toml . | |
| cp tests/data/pixi/test-pixi-complex-project/pixi.lock . | |
| - name: Test complex project setup | |
| uses: ./actions/python-setup/pixi | |
| with: | |
| environments: "default ml prod" | |
| activate-environment: "ml" | |
| cache: "false" | |
| - name: Verify ML environment | |
| run: | | |
| echo "Testing ML environment packages..." | |
| python -c "import numpy, pandas, scipy; print('Core packages OK')" | |
| python -c "import sklearn, xgboost, torch; print('ML packages OK')" | |
| python -c "import matplotlib, seaborn, plotly; print('Viz packages OK')" | |
| python -c "import pytest, black; print('Dev packages OK')" | |
| echo "Environment info:" | |
| pixi info | |
| pixi list -e ml |