Implement RUFF to replace many of the dependencies #23
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-mode Tests | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| schedule: | |
| - cron: '0 0 * * 0' # Weekly run | |
| jobs: | |
| test-linux: | |
| name: Test on Linux (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Ruff | |
| run: | | |
| pip install ruff | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y vim-nox git | |
| - name: Run Vader test suite | |
| run: | | |
| pwd | |
| ls -la scripts/cicd/ | |
| which bash | |
| bash --version | |
| bash scripts/cicd/run_vader_tests_direct.sh | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-linux-${{ matrix.python-version }} | |
| path: | | |
| test-results.json | |
| test-logs/ | |
| results/ | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: linux-python-${{ matrix.python-version }} | |
| test-macos: | |
| name: Test on macOS (Python ${{ matrix.python-version }}) | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Ruff | |
| run: | | |
| pip install ruff | |
| - name: Install Vim and coreutils | |
| run: | | |
| brew install vim coreutils | |
| # Ensure brew's bin directory is in PATH | |
| echo "$(brew --prefix)/bin" >> $GITHUB_PATH | |
| # Verify vim is available | |
| which vim | |
| vim --version | |
| # Verify timeout is available (from coreutils) | |
| # On macOS, coreutils installs commands with 'g' prefix, but PATH should have both | |
| which timeout || which gtimeout || echo "Warning: timeout command not found" | |
| # Test timeout command | |
| timeout --version || gtimeout --version || echo "Warning: timeout not working" | |
| - name: Run Vader test suite | |
| run: | | |
| pwd | |
| ls -la scripts/cicd/ | |
| which bash | |
| bash --version | |
| bash scripts/cicd/run_vader_tests_direct.sh | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-macos-${{ matrix.python-version }} | |
| path: | | |
| test-results.json | |
| test-logs/ | |
| results/ | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: macos-python-${{ matrix.python-version }} | |
| test-windows: | |
| name: Test on Windows (Python ${{ matrix.python-version }}) | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Ruff | |
| run: | | |
| pip install ruff | |
| - name: Install Vim | |
| shell: pwsh | |
| run: | | |
| # Install Vim using Chocolatey (available on GitHub Actions Windows runners) | |
| choco install vim -y | |
| # Refresh PATH to make vim available | |
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") | |
| # Also add common Vim installation paths | |
| $env:Path += ";C:\Program Files (x86)\Vim\vim91\bin;C:\Program Files\Vim\vim91\bin;C:\tools\vim\vim91\bin" | |
| # Add to GITHUB_PATH for subsequent steps | |
| $vimPaths = @( | |
| "C:\Program Files (x86)\Vim\vim91\bin", | |
| "C:\Program Files\Vim\vim91\bin", | |
| "C:\tools\vim\vim91\bin" | |
| ) | |
| foreach ($path in $vimPaths) { | |
| if (Test-Path $path) { | |
| echo "$path" >> $env:GITHUB_PATH | |
| Write-Host "Added to GITHUB_PATH: $path" | |
| } | |
| } | |
| # Verify vim is available | |
| $vimPath = (Get-Command vim -ErrorAction SilentlyContinue).Source | |
| if ($vimPath) { | |
| Write-Host "Vim found at: $vimPath" | |
| & $vimPath --version | |
| } else { | |
| Write-Host "Vim not in PATH, trying to find it..." | |
| $possiblePaths = @( | |
| "C:\Program Files (x86)\Vim\vim91\vim.exe", | |
| "C:\Program Files\Vim\vim91\vim.exe", | |
| "C:\tools\vim\vim91\vim.exe" | |
| ) | |
| $found = $false | |
| foreach ($path in $possiblePaths) { | |
| if (Test-Path $path) { | |
| Write-Host "Found Vim at: $path" | |
| & $path --version | |
| $found = $true | |
| break | |
| } | |
| } | |
| if (-not $found) { | |
| Write-Host "ERROR: Could not find Vim installation" | |
| exit 1 | |
| } | |
| } | |
| - name: Run Vader test suite | |
| shell: pwsh | |
| run: | | |
| Get-Location | |
| Get-ChildItem scripts\cicd\ | |
| Get-Command pwsh | Select-Object -ExpandProperty Source | |
| pwsh --version | |
| pwsh scripts/cicd/run_vader_tests_windows.ps1 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-windows-${{ matrix.python-version }} | |
| path: | | |
| test-results.json | |
| test-logs/ | |
| results/ | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| file: ./coverage.xml | |
| flags: windows-python-${{ matrix.python-version }} | |
| summary: | |
| name: Generate Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [test-linux, test-macos, test-windows] | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Download all test results | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: test-results-artifacts | |
| pattern: test-results-* | |
| merge-multiple: false | |
| - name: Install jq for JSON parsing | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y jq | |
| - name: Generate PR summary | |
| id: generate_summary | |
| run: | | |
| bash scripts/cicd/generate_pr_summary.sh test-results-artifacts pr-summary.md | |
| continue-on-error: true | |
| - name: Post PR comment | |
| uses: thollander/actions-comment-pull-request@v3 | |
| if: always() && github.event_name == 'pull_request' | |
| with: | |
| file-path: pr-summary.md | |
| comment-tag: test-summary |