-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (73 loc) · 2.9 KB
/
test.yml
File metadata and controls
87 lines (73 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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')
"