pyci-check 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyci_check-0.1.1/.github/workflows/README.md +232 -0
- pyci_check-0.1.1/.github/workflows/ci.yml +409 -0
- pyci_check-0.1.1/.github/workflows/release.yml +125 -0
- pyci_check-0.1.1/.gitignore +43 -0
- pyci_check-0.1.1/CHANGELOG.md +74 -0
- pyci_check-0.1.1/CONTRIBUTING.md +207 -0
- pyci_check-0.1.1/LICENSE +21 -0
- pyci_check-0.1.1/PKG-INFO +148 -0
- pyci_check-0.1.1/README.md +194 -0
- pyci_check-0.1.1/README.pypi.md +115 -0
- pyci_check-0.1.1/README.zh-CN.md +194 -0
- pyci_check-0.1.1/README.zh-TW.md +194 -0
- pyci_check-0.1.1/ci_preflight.sh +87 -0
- pyci_check-0.1.1/docs/RELEASE.md +166 -0
- pyci_check-0.1.1/docs/en/USAGE.md +420 -0
- pyci_check-0.1.1/docs/en/VALIDATION.md +380 -0
- pyci_check-0.1.1/docs/zh_CN/CONTRIBUTING.md +210 -0
- pyci_check-0.1.1/docs/zh_CN/USAGE.md +420 -0
- pyci_check-0.1.1/docs/zh_CN/VALIDATION.md +380 -0
- pyci_check-0.1.1/docs/zh_TW/CONTRIBUTING.md +207 -0
- pyci_check-0.1.1/docs/zh_TW/USAGE.md +420 -0
- pyci_check-0.1.1/docs/zh_TW/VALIDATION.md +380 -0
- pyci_check-0.1.1/pyproject.toml +295 -0
- pyci_check-0.1.1/pytest.ini +13 -0
- pyci_check-0.1.1/scripts/test_venv_priority.sh +23 -0
- pyci_check-0.1.1/src/pyci_check/__init__.py +3 -0
- pyci_check-0.1.1/src/pyci_check/cli.py +255 -0
- pyci_check-0.1.1/src/pyci_check/git_hook.py +311 -0
- pyci_check-0.1.1/src/pyci_check/i18n.py +125 -0
- pyci_check-0.1.1/src/pyci_check/imports.py +761 -0
- pyci_check-0.1.1/src/pyci_check/locales/en.py +86 -0
- pyci_check-0.1.1/src/pyci_check/locales/zh_CN.py +86 -0
- pyci_check-0.1.1/src/pyci_check/locales/zh_TW.py +86 -0
- pyci_check-0.1.1/src/pyci_check/syntax.py +160 -0
- pyci_check-0.1.1/src/pyci_check/utils.py +79 -0
- pyci_check-0.1.1/tests/__init__.py +1 -0
- pyci_check-0.1.1/tests/conftest.py +161 -0
- pyci_check-0.1.1/tests/test_cli.py +102 -0
- pyci_check-0.1.1/tests/test_git_hooks.py +209 -0
- pyci_check-0.1.1/tests/test_i18n.py +147 -0
- pyci_check-0.1.1/tests/test_imports.py +176 -0
- pyci_check-0.1.1/tests/test_imports_advanced.py +227 -0
- pyci_check-0.1.1/tests/test_integration.py +259 -0
- pyci_check-0.1.1/tests/test_syntax.py +84 -0
- pyci_check-0.1.1/tests/test_syntax_advanced.py +234 -0
- pyci_check-0.1.1/tests/test_utils.py +58 -0
- pyci_check-0.1.1/uv.lock +265 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# GitHub Actions CI Workflow
|
|
2
|
+
|
|
3
|
+
This document describes the CI/CD pipeline for pyci-check.
|
|
4
|
+
|
|
5
|
+
## Workflow Overview
|
|
6
|
+
|
|
7
|
+
The CI pipeline is organized into the following categories:
|
|
8
|
+
|
|
9
|
+
### 1. Code Quality
|
|
10
|
+
- **Job**: `code-quality`
|
|
11
|
+
- **Platform**: Ubuntu Latest
|
|
12
|
+
- **Purpose**: Ensures code meets style and formatting standards
|
|
13
|
+
- **Checks**:
|
|
14
|
+
- Ruff linting
|
|
15
|
+
- Ruff formatting
|
|
16
|
+
|
|
17
|
+
### 2. Self Check
|
|
18
|
+
- **Job**: `self-check`
|
|
19
|
+
- **Platform**: Ubuntu Latest
|
|
20
|
+
- **Purpose**: Uses pyci-check to validate itself
|
|
21
|
+
- **Checks**:
|
|
22
|
+
- Syntax check (AST parsing)
|
|
23
|
+
- Import check (static analysis)
|
|
24
|
+
- Import check (dynamic execution)
|
|
25
|
+
- Full check (all checks combined)
|
|
26
|
+
|
|
27
|
+
### 3. Cross-Platform Tests
|
|
28
|
+
- **Job**: `test-cross-platform`
|
|
29
|
+
- **Platforms**: Ubuntu, macOS, Windows
|
|
30
|
+
- **Python Versions**: 3.11, 3.12, 3.13
|
|
31
|
+
- **Purpose**: Ensures compatibility across different OS and Python versions
|
|
32
|
+
- **Matrix**: 9 combinations (3 OS × 3 Python versions)
|
|
33
|
+
- **Coverage**: Uploads coverage report from Ubuntu + Python 3.13
|
|
34
|
+
|
|
35
|
+
### 4. Categorized Tests
|
|
36
|
+
|
|
37
|
+
Individual test suites run in parallel on Ubuntu:
|
|
38
|
+
|
|
39
|
+
#### 4.1 Syntax Checker Tests
|
|
40
|
+
- **Job**: `test-syntax`
|
|
41
|
+
- **Files**: `test_syntax.py`, `test_syntax_advanced.py`
|
|
42
|
+
- **Purpose**: Tests the AST-based syntax checker
|
|
43
|
+
|
|
44
|
+
#### 4.2 Import Checker Tests
|
|
45
|
+
- **Job**: `test-imports`
|
|
46
|
+
- **Files**: `test_imports.py`, `test_imports_advanced.py`
|
|
47
|
+
- **Purpose**: Tests both static and dynamic import checking
|
|
48
|
+
|
|
49
|
+
#### 4.3 Git Hooks Tests
|
|
50
|
+
- **Job**: `test-git-hooks`
|
|
51
|
+
- **Files**: `test_git_hooks.py`
|
|
52
|
+
- **Purpose**: Tests hook installation, update, and removal
|
|
53
|
+
- **Special**: Initializes a Git repository for testing
|
|
54
|
+
|
|
55
|
+
#### 4.4 CLI Interface Tests
|
|
56
|
+
- **Job**: `test-cli`
|
|
57
|
+
- **Files**: `test_cli.py`
|
|
58
|
+
- **Purpose**: Tests command-line interface and argument parsing
|
|
59
|
+
|
|
60
|
+
#### 4.5 I18n Tests
|
|
61
|
+
- **Job**: `test-i18n`
|
|
62
|
+
- **Files**: `test_i18n.py`
|
|
63
|
+
- **Purpose**: Tests internationalization (en, zh_CN, zh_TW)
|
|
64
|
+
|
|
65
|
+
#### 4.6 Utilities Tests
|
|
66
|
+
- **Job**: `test-utils`
|
|
67
|
+
- **Files**: `test_utils.py`
|
|
68
|
+
- **Purpose**: Tests utility functions
|
|
69
|
+
|
|
70
|
+
#### 4.7 Integration Tests
|
|
71
|
+
- **Job**: `test-integration`
|
|
72
|
+
- **Files**: `test_integration.py`
|
|
73
|
+
- **Purpose**: Tests end-to-end workflows
|
|
74
|
+
|
|
75
|
+
### 5. Type Checking
|
|
76
|
+
- **Job**: `type-check`
|
|
77
|
+
- **Platform**: Ubuntu Latest
|
|
78
|
+
- **Purpose**: Static type checking with mypy
|
|
79
|
+
- **Note**: Currently runs in permissive mode (does not fail CI)
|
|
80
|
+
|
|
81
|
+
### 6. Package Build
|
|
82
|
+
- **Job**: `build`
|
|
83
|
+
- **Platform**: Ubuntu Latest
|
|
84
|
+
- **Depends on**: `code-quality`, `self-check`, `test-cross-platform`
|
|
85
|
+
- **Purpose**: Builds the distribution package
|
|
86
|
+
- **Outputs**:
|
|
87
|
+
- Wheel (.whl)
|
|
88
|
+
- Source distribution (.tar.gz)
|
|
89
|
+
- **Validation**: Runs `twine check` on built packages
|
|
90
|
+
- **Artifacts**: Uploads to GitHub Actions artifacts
|
|
91
|
+
|
|
92
|
+
### 7. Package Installation Tests
|
|
93
|
+
- **Job**: `test-install`
|
|
94
|
+
- **Platforms**: Ubuntu, macOS, Windows
|
|
95
|
+
- **Depends on**: `build`
|
|
96
|
+
- **Purpose**: Verifies package can be installed on all platforms
|
|
97
|
+
- **Checks**:
|
|
98
|
+
- Install from wheel
|
|
99
|
+
- CLI availability (`pyci-check --help`)
|
|
100
|
+
- Import verification
|
|
101
|
+
|
|
102
|
+
## Workflow Execution Flow
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
┌─────────────────┐
|
|
106
|
+
│ Code Quality │
|
|
107
|
+
└────────┬────────┘
|
|
108
|
+
│
|
|
109
|
+
▼
|
|
110
|
+
┌─────────────────┐ ┌──────────────────┐
|
|
111
|
+
│ Self Check │ │ Type Checking │
|
|
112
|
+
└────────┬────────┘ └──────────────────┘
|
|
113
|
+
│
|
|
114
|
+
▼
|
|
115
|
+
┌─────────────────────────────────────┐
|
|
116
|
+
│ Cross-Platform Tests (3×3 matrix) │
|
|
117
|
+
│ Ubuntu / macOS / Windows │
|
|
118
|
+
│ Python 3.11 / 3.12 / 3.13 │
|
|
119
|
+
└────────┬────────────────────────────┘
|
|
120
|
+
│
|
|
121
|
+
├──► Categorized Tests (parallel)
|
|
122
|
+
│ ├─ Syntax Checker
|
|
123
|
+
│ ├─ Import Checker
|
|
124
|
+
│ ├─ Git Hooks
|
|
125
|
+
│ ├─ CLI Interface
|
|
126
|
+
│ ├─ I18n
|
|
127
|
+
│ ├─ Utilities
|
|
128
|
+
│ └─ Integration
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
┌─────────────────┐
|
|
132
|
+
│ Package Build │
|
|
133
|
+
└────────┬────────┘
|
|
134
|
+
│
|
|
135
|
+
▼
|
|
136
|
+
┌─────────────────────────────┐
|
|
137
|
+
│ Package Installation Tests │
|
|
138
|
+
│ Ubuntu / macOS / Windows │
|
|
139
|
+
└─────────────────────────────┘
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Test Triggers
|
|
143
|
+
|
|
144
|
+
The CI pipeline runs on:
|
|
145
|
+
- **Push** to `main` or `develop` branches
|
|
146
|
+
- **Pull requests** targeting `main` or `develop` branches
|
|
147
|
+
|
|
148
|
+
## Performance Optimizations
|
|
149
|
+
|
|
150
|
+
- **Parallel Execution**: Categorized tests run in parallel
|
|
151
|
+
- **Fail Fast**: Set to `false` for cross-platform tests to see all failures
|
|
152
|
+
- **Caching**: pip cache enabled for faster dependency installation
|
|
153
|
+
- **Matrix Strategy**: Cross-platform tests use matrix for efficiency
|
|
154
|
+
|
|
155
|
+
## Monitoring Test Results
|
|
156
|
+
|
|
157
|
+
### Success Criteria
|
|
158
|
+
All jobs must pass for the CI to be considered successful, except:
|
|
159
|
+
- `type-check`: Runs in permissive mode (does not block)
|
|
160
|
+
|
|
161
|
+
### Coverage Reports
|
|
162
|
+
Coverage is collected from:
|
|
163
|
+
- **Platform**: Ubuntu Latest
|
|
164
|
+
- **Python**: 3.13
|
|
165
|
+
- **Upload**: Codecov (if configured)
|
|
166
|
+
|
|
167
|
+
## Local Testing
|
|
168
|
+
|
|
169
|
+
To run tests locally that match CI:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Code quality
|
|
173
|
+
ruff check .
|
|
174
|
+
ruff format --check .
|
|
175
|
+
|
|
176
|
+
# Self check
|
|
177
|
+
pyci-check syntax
|
|
178
|
+
pyci-check imports
|
|
179
|
+
pyci-check check .
|
|
180
|
+
|
|
181
|
+
# Run all tests
|
|
182
|
+
pytest tests/ -v --cov=src/pyci_check
|
|
183
|
+
|
|
184
|
+
# Run specific test category
|
|
185
|
+
pytest tests/test_syntax.py -v
|
|
186
|
+
pytest tests/test_imports.py -v
|
|
187
|
+
pytest tests/test_git_hooks.py -v
|
|
188
|
+
pytest tests/test_cli.py -v
|
|
189
|
+
pytest tests/test_i18n.py -v
|
|
190
|
+
pytest tests/test_utils.py -v
|
|
191
|
+
pytest tests/test_integration.py -v
|
|
192
|
+
|
|
193
|
+
# Type check
|
|
194
|
+
mypy src/pyci_check --ignore-missing-imports
|
|
195
|
+
|
|
196
|
+
# Build package
|
|
197
|
+
python -m build
|
|
198
|
+
twine check dist/*
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Adding New Tests
|
|
202
|
+
|
|
203
|
+
When adding new test files:
|
|
204
|
+
|
|
205
|
+
1. Create the test file in `tests/`
|
|
206
|
+
2. Add a new job in `.github/workflows/ci.yml` under "Categorized Tests"
|
|
207
|
+
3. Follow the naming convention: `test-<category>`
|
|
208
|
+
4. Update this README
|
|
209
|
+
|
|
210
|
+
Example:
|
|
211
|
+
|
|
212
|
+
```yaml
|
|
213
|
+
test-new-feature:
|
|
214
|
+
name: Test New Feature
|
|
215
|
+
runs-on: ubuntu-latest
|
|
216
|
+
steps:
|
|
217
|
+
- name: Checkout code
|
|
218
|
+
uses: actions/checkout@v4
|
|
219
|
+
- name: Set up Python
|
|
220
|
+
uses: actions/setup-python@v5
|
|
221
|
+
with:
|
|
222
|
+
python-version: "3.13"
|
|
223
|
+
cache: 'pip'
|
|
224
|
+
- name: Install dependencies
|
|
225
|
+
run: |
|
|
226
|
+
python -m pip install --upgrade pip
|
|
227
|
+
pip install pytest
|
|
228
|
+
pip install -e .
|
|
229
|
+
- name: Run new feature tests
|
|
230
|
+
run: |
|
|
231
|
+
pytest tests/test_new_feature.py -v
|
|
232
|
+
```
|
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, develop]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
# ==================== Code Quality ====================
|
|
11
|
+
code-quality:
|
|
12
|
+
name: Code Quality (Linting & Formatting)
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v5
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.13"
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --extra dev
|
|
29
|
+
|
|
30
|
+
- name: Run Ruff linter
|
|
31
|
+
run: |
|
|
32
|
+
echo "::group::Ruff Linting"
|
|
33
|
+
uv run ruff check . --config pyproject.toml --output-format=github
|
|
34
|
+
echo "::endgroup::"
|
|
35
|
+
|
|
36
|
+
- name: Run Ruff formatter check
|
|
37
|
+
run: |
|
|
38
|
+
echo "::group::Ruff Formatting"
|
|
39
|
+
uv run ruff format --check . --config pyproject.toml
|
|
40
|
+
echo "::endgroup::"
|
|
41
|
+
|
|
42
|
+
# ==================== Self Check ====================
|
|
43
|
+
self-check:
|
|
44
|
+
name: Self Check (pyci-check on itself)
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
|
|
47
|
+
steps:
|
|
48
|
+
- name: Checkout code
|
|
49
|
+
uses: actions/checkout@v4
|
|
50
|
+
|
|
51
|
+
- name: Install uv
|
|
52
|
+
uses: astral-sh/setup-uv@v5
|
|
53
|
+
|
|
54
|
+
- name: Set up Python
|
|
55
|
+
uses: actions/setup-python@v5
|
|
56
|
+
with:
|
|
57
|
+
python-version: "3.13"
|
|
58
|
+
|
|
59
|
+
- name: Install pyci-check
|
|
60
|
+
run: uv sync
|
|
61
|
+
|
|
62
|
+
- name: Run pyci-check syntax check
|
|
63
|
+
run: |
|
|
64
|
+
echo "::group::Syntax Check"
|
|
65
|
+
uv run pyci-check syntax
|
|
66
|
+
echo "::endgroup::"
|
|
67
|
+
|
|
68
|
+
- name: Run pyci-check imports check (static)
|
|
69
|
+
run: |
|
|
70
|
+
echo "::group::Import Check (Static)"
|
|
71
|
+
uv run pyci-check imports src/
|
|
72
|
+
echo "::endgroup::"
|
|
73
|
+
|
|
74
|
+
- name: Run pyci-check imports check (dynamic)
|
|
75
|
+
run: |
|
|
76
|
+
echo "::group::Import Check (Dynamic)"
|
|
77
|
+
uv run pyci-check imports src/ --i-understand-this-will-execute-code
|
|
78
|
+
echo "::endgroup::"
|
|
79
|
+
|
|
80
|
+
- name: Run pyci-check full check
|
|
81
|
+
run: |
|
|
82
|
+
echo "::group::Full Check"
|
|
83
|
+
uv run pyci-check check src/
|
|
84
|
+
echo "::endgroup::"
|
|
85
|
+
|
|
86
|
+
# ==================== Cross-Platform Tests ====================
|
|
87
|
+
test-cross-platform:
|
|
88
|
+
name: Test on ${{ matrix.os }} (Python ${{ matrix.python-version }})
|
|
89
|
+
runs-on: ${{ matrix.os }}
|
|
90
|
+
strategy:
|
|
91
|
+
fail-fast: true
|
|
92
|
+
matrix:
|
|
93
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
94
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
95
|
+
|
|
96
|
+
steps:
|
|
97
|
+
- name: Checkout code
|
|
98
|
+
uses: actions/checkout@v4
|
|
99
|
+
|
|
100
|
+
- name: Install uv
|
|
101
|
+
uses: astral-sh/setup-uv@v5
|
|
102
|
+
|
|
103
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
104
|
+
uses: actions/setup-python@v5
|
|
105
|
+
with:
|
|
106
|
+
python-version: ${{ matrix.python-version }}
|
|
107
|
+
|
|
108
|
+
- name: Install dependencies
|
|
109
|
+
run: uv sync --extra dev
|
|
110
|
+
|
|
111
|
+
- name: Run unit tests
|
|
112
|
+
run: |
|
|
113
|
+
uv run pytest tests/ -v --cov=src/pyci_check --cov-report=term-missing --cov-report=xml
|
|
114
|
+
|
|
115
|
+
- name: Upload coverage to Codecov
|
|
116
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13'
|
|
117
|
+
uses: codecov/codecov-action@v4
|
|
118
|
+
with:
|
|
119
|
+
file: ./coverage.xml
|
|
120
|
+
flags: unittests
|
|
121
|
+
name: codecov-umbrella
|
|
122
|
+
fail_ci_if_error: false
|
|
123
|
+
|
|
124
|
+
# ==================== Categorized Tests ====================
|
|
125
|
+
test-syntax:
|
|
126
|
+
name: Test Syntax Checker
|
|
127
|
+
runs-on: ubuntu-latest
|
|
128
|
+
|
|
129
|
+
steps:
|
|
130
|
+
- name: Checkout code
|
|
131
|
+
uses: actions/checkout@v4
|
|
132
|
+
|
|
133
|
+
- name: Install uv
|
|
134
|
+
uses: astral-sh/setup-uv@v5
|
|
135
|
+
|
|
136
|
+
- name: Set up Python
|
|
137
|
+
uses: actions/setup-python@v5
|
|
138
|
+
with:
|
|
139
|
+
python-version: "3.13"
|
|
140
|
+
|
|
141
|
+
- name: Install dependencies
|
|
142
|
+
run: uv sync --extra dev
|
|
143
|
+
|
|
144
|
+
- name: Run syntax tests
|
|
145
|
+
run: |
|
|
146
|
+
echo "::group::Syntax Checker Tests"
|
|
147
|
+
uv run pytest tests/test_syntax.py tests/test_syntax_advanced.py -v
|
|
148
|
+
echo "::endgroup::"
|
|
149
|
+
|
|
150
|
+
test-imports:
|
|
151
|
+
name: Test Import Checker
|
|
152
|
+
runs-on: ubuntu-latest
|
|
153
|
+
|
|
154
|
+
steps:
|
|
155
|
+
- name: Checkout code
|
|
156
|
+
uses: actions/checkout@v4
|
|
157
|
+
|
|
158
|
+
- name: Install uv
|
|
159
|
+
uses: astral-sh/setup-uv@v5
|
|
160
|
+
|
|
161
|
+
- name: Set up Python
|
|
162
|
+
uses: actions/setup-python@v5
|
|
163
|
+
with:
|
|
164
|
+
python-version: "3.13"
|
|
165
|
+
|
|
166
|
+
- name: Install dependencies
|
|
167
|
+
run: uv sync --extra dev
|
|
168
|
+
|
|
169
|
+
- name: Run import tests
|
|
170
|
+
run: |
|
|
171
|
+
echo "::group::Import Checker Tests"
|
|
172
|
+
uv run pytest tests/test_imports.py tests/test_imports_advanced.py -v
|
|
173
|
+
echo "::endgroup::"
|
|
174
|
+
|
|
175
|
+
test-git-hooks:
|
|
176
|
+
name: Test Git Hooks
|
|
177
|
+
runs-on: ubuntu-latest
|
|
178
|
+
|
|
179
|
+
steps:
|
|
180
|
+
- name: Checkout code
|
|
181
|
+
uses: actions/checkout@v4
|
|
182
|
+
|
|
183
|
+
- name: Install uv
|
|
184
|
+
uses: astral-sh/setup-uv@v5
|
|
185
|
+
|
|
186
|
+
- name: Set up Python
|
|
187
|
+
uses: actions/setup-python@v5
|
|
188
|
+
with:
|
|
189
|
+
python-version: "3.13"
|
|
190
|
+
|
|
191
|
+
- name: Install dependencies
|
|
192
|
+
run: uv sync --extra dev
|
|
193
|
+
|
|
194
|
+
- name: Initialize Git repository
|
|
195
|
+
run: |
|
|
196
|
+
git config --global user.email "ci@example.com"
|
|
197
|
+
git config --global user.name "CI Bot"
|
|
198
|
+
git init
|
|
199
|
+
|
|
200
|
+
- name: Run git hooks tests
|
|
201
|
+
run: |
|
|
202
|
+
echo "::group::Git Hooks Tests"
|
|
203
|
+
uv run pytest tests/test_git_hooks.py -v
|
|
204
|
+
echo "::endgroup::"
|
|
205
|
+
|
|
206
|
+
test-cli:
|
|
207
|
+
name: Test CLI Interface
|
|
208
|
+
runs-on: ubuntu-latest
|
|
209
|
+
|
|
210
|
+
steps:
|
|
211
|
+
- name: Checkout code
|
|
212
|
+
uses: actions/checkout@v4
|
|
213
|
+
|
|
214
|
+
- name: Install uv
|
|
215
|
+
uses: astral-sh/setup-uv@v5
|
|
216
|
+
|
|
217
|
+
- name: Set up Python
|
|
218
|
+
uses: actions/setup-python@v5
|
|
219
|
+
with:
|
|
220
|
+
python-version: "3.13"
|
|
221
|
+
|
|
222
|
+
- name: Install dependencies
|
|
223
|
+
run: uv sync --extra dev
|
|
224
|
+
|
|
225
|
+
- name: Run CLI tests
|
|
226
|
+
run: |
|
|
227
|
+
echo "::group::CLI Tests"
|
|
228
|
+
uv run pytest tests/test_cli.py -v
|
|
229
|
+
echo "::endgroup::"
|
|
230
|
+
|
|
231
|
+
test-i18n:
|
|
232
|
+
name: Test Internationalization
|
|
233
|
+
runs-on: ubuntu-latest
|
|
234
|
+
|
|
235
|
+
steps:
|
|
236
|
+
- name: Checkout code
|
|
237
|
+
uses: actions/checkout@v4
|
|
238
|
+
|
|
239
|
+
- name: Install uv
|
|
240
|
+
uses: astral-sh/setup-uv@v5
|
|
241
|
+
|
|
242
|
+
- name: Set up Python
|
|
243
|
+
uses: actions/setup-python@v5
|
|
244
|
+
with:
|
|
245
|
+
python-version: "3.13"
|
|
246
|
+
|
|
247
|
+
- name: Install dependencies
|
|
248
|
+
run: uv sync --extra dev
|
|
249
|
+
|
|
250
|
+
- name: Run i18n tests
|
|
251
|
+
run: |
|
|
252
|
+
echo "::group::I18n Tests"
|
|
253
|
+
uv run pytest tests/test_i18n.py -v
|
|
254
|
+
echo "::endgroup::"
|
|
255
|
+
|
|
256
|
+
test-utils:
|
|
257
|
+
name: Test Utilities
|
|
258
|
+
runs-on: ubuntu-latest
|
|
259
|
+
|
|
260
|
+
steps:
|
|
261
|
+
- name: Checkout code
|
|
262
|
+
uses: actions/checkout@v4
|
|
263
|
+
|
|
264
|
+
- name: Install uv
|
|
265
|
+
uses: astral-sh/setup-uv@v5
|
|
266
|
+
|
|
267
|
+
- name: Set up Python
|
|
268
|
+
uses: actions/setup-python@v5
|
|
269
|
+
with:
|
|
270
|
+
python-version: "3.13"
|
|
271
|
+
|
|
272
|
+
- name: Install dependencies
|
|
273
|
+
run: uv sync --extra dev
|
|
274
|
+
|
|
275
|
+
- name: Run utils tests
|
|
276
|
+
run: |
|
|
277
|
+
echo "::group::Utils Tests"
|
|
278
|
+
uv run pytest tests/test_utils.py -v
|
|
279
|
+
echo "::endgroup::"
|
|
280
|
+
|
|
281
|
+
test-integration:
|
|
282
|
+
name: Test Integration
|
|
283
|
+
runs-on: ubuntu-latest
|
|
284
|
+
|
|
285
|
+
steps:
|
|
286
|
+
- name: Checkout code
|
|
287
|
+
uses: actions/checkout@v4
|
|
288
|
+
|
|
289
|
+
- name: Install uv
|
|
290
|
+
uses: astral-sh/setup-uv@v5
|
|
291
|
+
|
|
292
|
+
- name: Set up Python
|
|
293
|
+
uses: actions/setup-python@v5
|
|
294
|
+
with:
|
|
295
|
+
python-version: "3.13"
|
|
296
|
+
|
|
297
|
+
- name: Install dependencies
|
|
298
|
+
run: uv sync --extra dev
|
|
299
|
+
|
|
300
|
+
- name: Run integration tests
|
|
301
|
+
run: |
|
|
302
|
+
echo "::group::Integration Tests"
|
|
303
|
+
uv run pytest tests/test_integration.py -v
|
|
304
|
+
echo "::endgroup::"
|
|
305
|
+
|
|
306
|
+
# ==================== Type Checking ====================
|
|
307
|
+
type-check:
|
|
308
|
+
name: Type Check (mypy)
|
|
309
|
+
runs-on: ubuntu-latest
|
|
310
|
+
|
|
311
|
+
steps:
|
|
312
|
+
- name: Checkout code
|
|
313
|
+
uses: actions/checkout@v4
|
|
314
|
+
|
|
315
|
+
- name: Install uv
|
|
316
|
+
uses: astral-sh/setup-uv@v5
|
|
317
|
+
|
|
318
|
+
- name: Set up Python
|
|
319
|
+
uses: actions/setup-python@v5
|
|
320
|
+
with:
|
|
321
|
+
python-version: "3.13"
|
|
322
|
+
|
|
323
|
+
- name: Install dependencies
|
|
324
|
+
run: |
|
|
325
|
+
uv sync
|
|
326
|
+
uv pip install mypy
|
|
327
|
+
|
|
328
|
+
- name: Run mypy
|
|
329
|
+
run: |
|
|
330
|
+
echo "::group::Type Check"
|
|
331
|
+
uv run mypy src/pyci_check --ignore-missing-imports --no-strict-optional || true
|
|
332
|
+
echo "::endgroup::"
|
|
333
|
+
|
|
334
|
+
# ==================== Package Build ====================
|
|
335
|
+
build:
|
|
336
|
+
name: Build Package
|
|
337
|
+
runs-on: ubuntu-latest
|
|
338
|
+
needs: [code-quality, self-check, test-cross-platform]
|
|
339
|
+
|
|
340
|
+
steps:
|
|
341
|
+
- name: Checkout code
|
|
342
|
+
uses: actions/checkout@v4
|
|
343
|
+
|
|
344
|
+
- name: Install uv
|
|
345
|
+
uses: astral-sh/setup-uv@v5
|
|
346
|
+
|
|
347
|
+
- name: Set up Python
|
|
348
|
+
uses: actions/setup-python@v5
|
|
349
|
+
with:
|
|
350
|
+
python-version: "3.13"
|
|
351
|
+
|
|
352
|
+
- name: Build package
|
|
353
|
+
run: |
|
|
354
|
+
echo "::group::Build Package"
|
|
355
|
+
uv build
|
|
356
|
+
echo "::endgroup::"
|
|
357
|
+
|
|
358
|
+
- name: Check package with twine
|
|
359
|
+
run: |
|
|
360
|
+
echo "::group::Twine Check"
|
|
361
|
+
uv tool run twine check dist/*
|
|
362
|
+
echo "::endgroup::"
|
|
363
|
+
|
|
364
|
+
- name: Upload build artifacts
|
|
365
|
+
uses: actions/upload-artifact@v4
|
|
366
|
+
with:
|
|
367
|
+
name: dist-packages
|
|
368
|
+
path: dist/
|
|
369
|
+
|
|
370
|
+
# ==================== Package Installation Tests ====================
|
|
371
|
+
test-install:
|
|
372
|
+
name: Test Package Installation on ${{ matrix.os }}
|
|
373
|
+
runs-on: ${{ matrix.os }}
|
|
374
|
+
needs: [build]
|
|
375
|
+
strategy:
|
|
376
|
+
fail-fast: false
|
|
377
|
+
matrix:
|
|
378
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
379
|
+
|
|
380
|
+
steps:
|
|
381
|
+
- name: Set up Python
|
|
382
|
+
uses: actions/setup-python@v5
|
|
383
|
+
with:
|
|
384
|
+
python-version: "3.13"
|
|
385
|
+
|
|
386
|
+
- name: Download build artifacts
|
|
387
|
+
uses: actions/download-artifact@v4
|
|
388
|
+
with:
|
|
389
|
+
name: dist-packages
|
|
390
|
+
path: dist/
|
|
391
|
+
|
|
392
|
+
- name: Install from wheel
|
|
393
|
+
shell: bash
|
|
394
|
+
run: |
|
|
395
|
+
echo "::group::Install Package"
|
|
396
|
+
pip install dist/*.whl
|
|
397
|
+
echo "::endgroup::"
|
|
398
|
+
|
|
399
|
+
- name: Test CLI is available
|
|
400
|
+
run: |
|
|
401
|
+
echo "::group::Test CLI"
|
|
402
|
+
pyci-check --help
|
|
403
|
+
echo "::endgroup::"
|
|
404
|
+
|
|
405
|
+
- name: Verify installation
|
|
406
|
+
run: |
|
|
407
|
+
echo "::group::Verify Installation"
|
|
408
|
+
python -c "import pyci_check; print(f'pyci-check version: {pyci_check.__version__}')"
|
|
409
|
+
echo "::endgroup::"
|