This repository was archived by the owner on Nov 23, 2025. It is now read-only.
Re-enable all platform tests - WSL issues resolved #55
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: Python Tests | |
| on: | |
| push: | |
| branches: [ main, v2, copilot/** ] | |
| pull_request: | |
| branches: [ main, v2 ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: python | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install bandit safety | |
| - name: Run Bandit security scan | |
| run: | | |
| bandit -r src/gitspaces -f json -o bandit-report.json || true | |
| bandit -r src/gitspaces -ll || true | |
| - name: Check dependencies for vulnerabilities | |
| run: | | |
| safety check --json || true | |
| safety check || echo "Safety check failed or requires authentication" | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| shell: [default] | |
| include: | |
| # Windows PowerShell tests | |
| - os: windows-latest | |
| python-version: '3.8' | |
| shell: pwsh | |
| - os: windows-latest | |
| python-version: '3.9' | |
| shell: pwsh | |
| - os: windows-latest | |
| python-version: '3.10' | |
| shell: pwsh | |
| - os: windows-latest | |
| python-version: '3.11' | |
| shell: pwsh | |
| - os: windows-latest | |
| python-version: '3.12' | |
| shell: pwsh | |
| - os: windows-latest | |
| python-version: '3.13' | |
| shell: pwsh | |
| # Windows cmd.exe tests | |
| - os: windows-latest | |
| python-version: '3.8' | |
| shell: cmd | |
| - os: windows-latest | |
| python-version: '3.9' | |
| shell: cmd | |
| - os: windows-latest | |
| python-version: '3.10' | |
| shell: cmd | |
| - os: windows-latest | |
| python-version: '3.11' | |
| shell: cmd | |
| - os: windows-latest | |
| python-version: '3.12' | |
| shell: cmd | |
| - os: windows-latest | |
| python-version: '3.13' | |
| shell: cmd | |
| # Windows WSL bash tests | |
| - os: windows-latest | |
| python-version: '3.8' | |
| shell: wsl-bash | |
| - os: windows-latest | |
| python-version: '3.9' | |
| shell: wsl-bash | |
| - os: windows-latest | |
| python-version: '3.10' | |
| shell: wsl-bash | |
| - os: windows-latest | |
| python-version: '3.11' | |
| shell: wsl-bash | |
| - os: windows-latest | |
| python-version: '3.12' | |
| shell: wsl-bash | |
| - os: windows-latest | |
| python-version: '3.13' | |
| shell: wsl-bash | |
| defaults: | |
| run: | |
| shell: ${{ matrix.shell == 'cmd' && 'cmd' || matrix.shell == 'pwsh' && 'pwsh' || matrix.shell == 'wsl-bash' && 'wsl-bash {0}' || 'bash' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up WSL | |
| if: matrix.shell == 'wsl-bash' | |
| uses: Vampire/setup-wsl@v3 | |
| with: | |
| distribution: Ubuntu-22.04 | |
| use-cache: false # Disable cache to avoid corruption issues | |
| - name: Set up Python ${{ matrix.python-version }} (WSL) | |
| if: matrix.shell == 'wsl-bash' | |
| shell: wsl-bash {0} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y software-properties-common | |
| sudo add-apt-repository -y ppa:deadsnakes/ppa | |
| sudo apt-get update | |
| # Install Python - note: distutils not available for 3.12+, use full setuptools | |
| if [ "${{ matrix.python-version }}" = "3.13" ] || [ "${{ matrix.python-version }}" = "3.12" ]; then | |
| sudo apt-get install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-venv python3-pip python3-setuptools || { | |
| echo "Python ${{ matrix.python-version }} not available in deadsnakes, trying default repos" | |
| sudo apt-get install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-venv python3-pip | |
| } | |
| else | |
| sudo apt-get install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils python3-pip | |
| fi | |
| python${{ matrix.python-version }} --version | |
| - name: Set up Python ${{ matrix.python-version }} | |
| if: matrix.shell != 'wsl-bash' | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies (WSL) | |
| if: matrix.shell == 'wsl-bash' | |
| shell: wsl-bash {0} | |
| run: | | |
| # Ensure pip is available for this Python version | |
| python${{ matrix.python-version }} -m ensurepip --default-pip 2>/dev/null || true | |
| python${{ matrix.python-version }} -m pip install --upgrade pip setuptools wheel | |
| python${{ matrix.python-version }} -m pip install -e . | |
| python${{ matrix.python-version }} -m pip install -r requirements-dev.txt | |
| - name: Install dependencies | |
| if: matrix.shell != 'wsl-bash' | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| pip install -e . | |
| pip install -r requirements-dev.txt | |
| - name: Lint with flake8 (WSL) | |
| if: matrix.shell == 'wsl-bash' | |
| shell: wsl-bash {0} | |
| run: | | |
| # Stop the build if there are Python syntax errors or undefined names | |
| python${{ matrix.python-version }} -m flake8 src/gitspaces --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # Exit-zero treats all errors as warnings | |
| python${{ matrix.python-version }} -m flake8 src/gitspaces --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Lint with flake8 | |
| if: matrix.shell != 'wsl-bash' | |
| run: | | |
| # Stop the build if there are Python syntax errors or undefined names | |
| flake8 src/gitspaces --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # Exit-zero treats all errors as warnings | |
| flake8 src/gitspaces --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| - name: Check code formatting with black (WSL) | |
| if: matrix.shell == 'wsl-bash' | |
| shell: wsl-bash {0} | |
| run: | | |
| python${{ matrix.python-version }} -m black --check src/gitspaces tests | |
| - name: Check code formatting with black | |
| if: matrix.shell != 'wsl-bash' | |
| run: | | |
| black --check src/gitspaces tests | |
| - name: Run tests with pytest (WSL) | |
| if: matrix.shell == 'wsl-bash' | |
| shell: wsl-bash {0} | |
| run: | | |
| python${{ matrix.python-version }} -m pytest tests/ -v --cov=src/gitspaces --cov-report=xml --cov-report=term | |
| - name: Run tests with pytest | |
| if: matrix.shell != 'wsl-bash' | |
| run: | | |
| pytest tests/ -v --cov=src/gitspaces --cov-report=xml --cov-report=term | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
| with: | |
| file: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella |