add tests for pixi #18
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 pip | |
| on: | |
| push: | |
| jobs: | |
| test-pip-basic: | |
| name: Test pip action - defaults | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Test pip action with defaults (cache='') | |
| uses: ./actions/python-setup/pip | |
| - name: Verify Python installation | |
| run: | | |
| python --version | |
| pip --version | |
| pip list | |
| test-pip-with-groups: | |
| name: Test pip action - With dependency groups | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test pyproject.toml | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-project" | |
| version = "0.1.0" | |
| dependencies = ["requests"] | |
| [project.optional-dependencies] | |
| dev = ["pytest", "black"] | |
| test = ["pytest-cov"] | |
| docs = ["mkdocs"] | |
| EOF | |
| - name: Test pip action with dependency groups | |
| uses: ./actions/python-setup/pip | |
| with: | |
| install-groups: 'dev test' | |
| - name: Verify installations | |
| shell: bash | |
| run: | | |
| python --version | |
| pip list | |
| # Verify dev dependencies are installed | |
| python -c "import pytest; import black; print('[OK] Dev dependencies installed')" | |
| python -c "import pytest_cov; print('[OK] Test dependencies installed')" | |
| test-pip-matrix: | |
| name: Test pip action - Matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create minimal pyproject.toml | |
| shell: bash | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-matrix" | |
| version = "0.1.0" | |
| EOF | |
| - name: Test pip action with Python ${{ matrix.python-version }} | |
| uses: ./actions/python-setup/pip | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Verify Python version | |
| run: | | |
| python --version | |
| python -c "import sys; assert sys.version_info[:2] == tuple(map(int, '${{ matrix.python-version }}'.split('.')[:2]))" | |
| pip list | |
| - name: Test pip functionality | |
| shell: bash | |
| run: | | |
| pip install requests | |
| python -c "import requests; print(f'[OK] requests {requests.__version__} installed successfully')" | |
| test-pip-cache: | |
| name: Test pip action - Cache validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test pyproject.toml | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-cache" | |
| version = "0.1.0" | |
| dependencies = ["requests", "numpy"] | |
| EOF | |
| - name: First run - populate cache | |
| uses: ./actions/python-setup/pip | |
| with: | |
| cache: 'pip' | |
| - name: Verify cache is working | |
| run: | | |
| pip list | |
| echo "Cache should be populated for subsequent runs" | |
| test-pip-architecture: | |
| name: Test pip action - Architecture | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| architecture: [x64, x86] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create minimal pyproject.toml | |
| shell: bash | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-architecture" | |
| version = "0.1.0" | |
| EOF | |
| - name: Test pip action with ${{ matrix.architecture }} | |
| uses: ./actions/python-setup/pip | |
| with: | |
| architecture: ${{ matrix.architecture }} | |
| - name: Verify architecture | |
| run: | | |
| python --version | |
| python -c "import platform; print(f'Architecture: {platform.architecture()}')" | |
| test-pip-cache-validation-error: | |
| name: Test pip action - Cache validation error | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Test pip action with cache but no dependency file (should fail) | |
| id: test-cache-error | |
| continue-on-error: true | |
| uses: ./actions/python-setup/pip | |
| with: | |
| cache: 'pip' | |
| - name: Verify action failed as expected | |
| shell: bash | |
| run: | | |
| if [ "${{ steps.test-cache-error.outcome }}" != "failure" ]; then | |
| echo "::error::Expected action to fail when cache is enabled without pyproject.toml/requirements.txt" | |
| exit 1 | |
| fi | |
| echo "[OK] Action correctly failed when cache enabled without dependency files" | |
| test-pip-cache-with-requirements: | |
| name: Test pip action - Cache with requirements.txt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create requirements.txt | |
| run: | | |
| cat > requirements.txt << 'EOF' | |
| requests==2.31.0 | |
| numpy==1.26.0 | |
| EOF | |
| - name: Test pip action with cache and requirements.txt | |
| uses: ./actions/python-setup/pip | |
| with: | |
| cache: 'pip' | |
| - name: Verify cache validation passed | |
| shell: bash | |
| run: | | |
| python --version | |
| pip list | |
| echo "[OK] Cache validation passed with requirements.txt" | |
| test-pip-no-dependency-file: | |
| name: Test pip action - No dependency files (no cache) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Test pip action without pyproject.toml or requirements.txt | |
| uses: ./actions/python-setup/pip | |
| - name: Verify Python still works | |
| shell: bash | |
| run: | | |
| python --version | |
| pip --version | |
| pip install requests | |
| python -c "import requests; print('[OK] Can still install packages without dependency files')" |