Support newer python version #1
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 Repository Listing | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov | |
| - name: Install package | |
| run: | | |
| pip install -e . | |
| - name: Run linting checks | |
| run: | | |
| pip install flake8 | |
| # Stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # Treat all other issues as warnings | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=79 --statistics | |
| - name: Test package installation and imports | |
| run: | | |
| python -c "from github_repo_deleter.repo_deleter import main, get_token, run_delete; print('All imports successful')" | |
| python -c "import github_repo_deleter; print('Package import successful')" | |
| - name: Test CLI help command | |
| run: | | |
| python -m github_repo_deleter.repo_deleter --help || echo "Help command test completed" | |
| remove_github_repos --help || echo "Console script help test completed" | |
| - name: Run unit tests | |
| run: | | |
| python -m pytest tests/test_repo_listing.py::TestRepoListing -v --tb=short | |
| python -m pytest tests/test_cli.py::TestCLI -v --tb=short | |
| python -m pytest tests/test_cli.py::TestErrorHandling -v --tb=short | |
| - name: Run full test suite | |
| run: | | |
| python -m pytest tests/ -v --tb=short --durations=10 | |
| - name: Test GitHub API integration (if token available) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| if [ -n "$GITHUB_TOKEN" ]; then | |
| echo "Running integration tests with GitHub API..." | |
| python -m pytest tests/test_repo_listing.py::TestGitHubIntegration -v --tb=short | |
| else | |
| echo "No GITHUB_TOKEN available, skipping integration tests" | |
| fi | |
| - name: Test package metadata | |
| run: | | |
| python -c " | |
| import pkg_resources | |
| import github_repo_deleter | |
| print('Package version check passed') | |
| # Check if console script is registered | |
| entry_points = pkg_resources.get_entry_map('pygithubrepodeleter') | |
| console_scripts = entry_points.get('console_scripts', {}) | |
| assert 'remove_github_repos' in console_scripts, 'Console script not found' | |
| print('Console script registration check passed') | |
| " |