fix caching issue #33
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/uv | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| test-uv-basic: | |
| name: Test uv action - defaults (core only) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project with uv | |
| run: | | |
| # Create pyproject.toml | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-basic" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| # Initialize uv and create lock file | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with defaults (no groups) | |
| uses: ./actions/python-setup/uv | |
| - name: Verify installations | |
| shell: bash | |
| run: | | |
| python --version | |
| uv --version | |
| uv pip list | |
| # Verify core dependency is installed | |
| python -c "import requests; print('[OK] Core dependency installed')" | |
| # Verify dev group is NOT installed (default is now empty) | |
| if python -c "import httpx" 2>/dev/null; then | |
| echo "[ERROR] httpx should not be installed" | |
| exit 1 | |
| else | |
| echo "[OK] Dev group not installed with default empty install-groups" | |
| fi | |
| test-uv-custom-groups: | |
| name: Test uv action - Custom install groups | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project with multiple groups | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-groups" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| test = ["pytest-cov", "pytest-mock"] | |
| docs = ["mkdocs"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with custom groups | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: 'groups: test docs' | |
| - name: Verify custom groups installed | |
| shell: bash | |
| run: | | |
| uv pip list | |
| # Verify core dependencies are installed | |
| python -c "import requests; print('[OK] Core dependencies installed')" | |
| # Verify test and docs groups are installed | |
| python -c "import pytest_cov; import pytest_mock; print('[OK] Test dependencies installed')" | |
| python -c "import mkdocs; print('[OK] Docs dependencies installed')" | |
| # Verify dev group is NOT installed | |
| if python -c "import httpx" 2>/dev/null; then | |
| echo "[ERROR] httpx should not be installed" | |
| exit 1 | |
| else | |
| echo "[OK] Dev group not installed as expected" | |
| fi | |
| test-uv-no-groups: | |
| name: Test uv action - No groups (core only) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-no-groups" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with empty groups | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: '' | |
| - name: Verify only core dependencies | |
| shell: bash | |
| run: | | |
| uv pip list | |
| # Verify core dependency is installed | |
| python -c "import requests; print('[OK] Core dependency installed')" | |
| # Verify dev group is NOT installed | |
| if python -c "import httpx" 2>/dev/null; then | |
| echo "[ERROR] httpx should not be installed" | |
| exit 1 | |
| else | |
| echo "[OK] No optional groups installed" | |
| fi | |
| test-uv-lock-verification: | |
| name: Test uv action - Lock file verification | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project with up-to-date lock | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-lock" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with lock verification enabled (default) | |
| uses: ./actions/python-setup/uv | |
| - name: Verify lock check passed | |
| shell: bash | |
| run: | | |
| echo "[OK] Lock verification passed" | |
| test-uv-lock-verification-disabled: | |
| name: Test uv action - Lock verification disabled | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project with potentially outdated lock | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-no-verify" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with lock verification disabled | |
| uses: ./actions/python-setup/uv | |
| with: | |
| verify-lock: 'false' | |
| - name: Verify installation succeeded | |
| shell: bash | |
| run: | | |
| uv pip list | |
| python -c "import requests; print('[OK] Dependencies installed without lock verification')" | |
| test-uv-lock-verification-fail: | |
| name: Test uv action - Lock verification failure | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project with outdated lock | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-lock-fail" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests==2.28.0"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| # Modify pyproject.toml to make lock outdated | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-lock-fail" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests==2.31.0"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| - name: Test uv action with outdated lock (should fail) | |
| id: test-lock-fail | |
| continue-on-error: true | |
| uses: ./actions/python-setup/uv | |
| - name: Verify action failed as expected | |
| shell: bash | |
| run: | | |
| if [ "${{ steps.test-lock-fail.outcome }}" != "failure" ]; then | |
| echo "::error::Expected action to fail when lock file is outdated" | |
| exit 1 | |
| fi | |
| echo "[OK] Action correctly failed when lock file is outdated" | |
| test-uv-matrix: | |
| name: Test uv action - Matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| python-version: ['3.10', '3.11', '3.12'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| shell: bash | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-matrix" | |
| version = "0.1.0" | |
| requires-python = ">=3.10" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with Python ${{ matrix.python-version }} | |
| uses: ./actions/python-setup/uv | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| install-groups: 'groups: dev' | |
| - name: Verify Python version | |
| shell: bash | |
| run: | | |
| python --version | |
| python -c "import sys; assert sys.version_info[:2] == tuple(map(int, '${{ matrix.python-version }}'.split('.')[:2]))" | |
| uv pip list | |
| - name: Test uv functionality | |
| shell: bash | |
| run: | | |
| python -c "import requests; import httpx; print(f'[OK] Python ${{ matrix.python-version }} working on ${{ matrix.os }}')" | |
| test-uv-cache: | |
| name: Test uv action - Cache functionality | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-cache" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests", "numpy"] | |
| [dependency-groups] | |
| dev = ["httpx", "mypy"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: First run - populate cache | |
| uses: ./actions/python-setup/uv | |
| - name: Verify cache populated | |
| shell: bash | |
| run: | | |
| uv pip list | |
| echo "[OK] Cache should be populated for subsequent runs" | |
| test-uv-multiple-groups: | |
| name: Test uv action - Multiple dependency groups | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-multiple" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| test = ["pytest-cov"] | |
| docs = ["mkdocs"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with multiple dependency groups | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: 'groups: dev test docs' | |
| - name: Verify all groups installed | |
| shell: bash | |
| run: | | |
| python -c "import httpx; import pytest_cov; import mkdocs; print('[OK] All multiple groups installed')" | |
| test-uv-no-dependency-groups-section: | |
| name: Test uv action - No dependency-groups section | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project without dependency-groups | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-no-groups-section" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with defaults (should work - no groups) | |
| uses: ./actions/python-setup/uv | |
| - name: Verify action succeeded with core dependencies only | |
| shell: bash | |
| run: | | |
| python -c "import requests; print('[OK] Core dependencies installed without dependency-groups section')" | |
| uv pip list | |
| echo "[OK] Action succeeded without dependency-groups section" | |
| test-uv-explicit-dev-group: | |
| name: Test uv action - Explicit dev group | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-explicit-dev" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with explicit dev group | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: 'groups: dev' | |
| - name: Verify dev group installed | |
| shell: bash | |
| run: | | |
| python -c "import httpx; print('[OK] Dev group explicitly installed')" | |
| test-uv-empty-sections: | |
| name: Test uv action - Empty groups/extras sections | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-empty" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [project.optional-dependencies] | |
| aws = ["boto3"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with empty groups section | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: 'groups: , extras: aws' | |
| - name: Verify empty groups handling | |
| shell: bash | |
| run: | | |
| uv pip list | |
| python -c "import requests; print('[OK] Core dependencies installed')" | |
| python -c "import boto3; print('[OK] AWS extra installed')" | |
| test-uv-invalid-format: | |
| name: Test uv action - Invalid format handling | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-invalid" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with invalid format (should show warning) | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: 'invalid format without colons' | |
| - name: Verify warning shown and core dependencies installed | |
| shell: bash | |
| run: | | |
| uv pip list | |
| python -c "import requests; print('[OK] Core dependencies installed despite invalid format')" | |
| test-uv-optional-dependencies: | |
| name: Test uv action - Optional dependencies (extras) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project with optional dependencies | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-extras" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [project.optional-dependencies] | |
| aws = ["boto3", "s3fs"] | |
| viz = ["matplotlib", "seaborn"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| test = ["pytest"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with optional dependencies only | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: 'extras: aws viz' | |
| - name: Verify optional dependencies installed | |
| shell: bash | |
| run: | | |
| uv pip list | |
| # Verify core dependencies are installed | |
| python -c "import requests; print('[OK] Core dependencies installed')" | |
| # Verify optional dependencies are installed | |
| python -c "import boto3; import s3fs; print('[OK] AWS extras installed')" | |
| python -c "import matplotlib; import seaborn; print('[OK] Viz extras installed')" | |
| # Verify dev group is NOT installed | |
| if python -c "import httpx" 2>/dev/null; then | |
| echo "[ERROR] httpx should not be installed" | |
| exit 1 | |
| else | |
| echo "[OK] Dev group not installed as expected" | |
| fi | |
| test-uv-mixed-groups-and-extras: | |
| name: Test uv action - Mixed groups and extras | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Create test project | |
| run: | | |
| cat > pyproject.toml << 'EOF' | |
| [project] | |
| name = "test-uv-mixed" | |
| version = "0.1.0" | |
| requires-python = ">=3.12" | |
| dependencies = ["requests"] | |
| [project.optional-dependencies] | |
| aws = ["boto3"] | |
| viz = ["matplotlib"] | |
| [dependency-groups] | |
| dev = ["httpx"] | |
| test = ["pytest"] | |
| EOF | |
| pip install uv | |
| uv lock | |
| - name: Test uv action with mixed groups and extras | |
| uses: ./actions/python-setup/uv | |
| with: | |
| install-groups: 'groups: dev test, extras: aws viz' | |
| - name: Verify mixed installation | |
| shell: bash | |
| run: | | |
| uv pip list | |
| # Verify all requested dependencies are installed | |
| python -c "import requests; print('[OK] Core dependencies installed')" | |
| python -c "import httpx; print('[OK] Dev group installed')" | |
| python -c "import pytest; print('[OK] Test group installed')" | |
| python -c "import boto3; print('[OK] AWS extra installed')" | |
| python -c "import matplotlib; print('[OK] Viz extra installed')" |