Skip to content

Commit 217840f

Browse files
authored
refactor: decouple for mkdocstrings-python
BREAKING CHANGE: configuration options have been updated to use MATLAB terminology
1 parent afb71f9 commit 217840f

214 files changed

Lines changed: 25498 additions & 3324 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/qualify.yaml

Lines changed: 117 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ on:
1414
branches:
1515
- main
1616

17-
permissions:
18-
contents: write
19-
pull-requests: write
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
19+
cancel-in-progress: true
2020

2121
jobs:
2222
docs:
@@ -26,74 +26,139 @@ jobs:
2626
concurrency:
2727
group: gh-pages
2828
cancel-in-progress: false
29+
permissions:
30+
contents: write
2931
secrets: inherit
3032
with:
3133
version: ${{ format('pr-{0}', github.head_ref) || 'test' }}
3234
alias: ""
3335
set-default: false
3436
push: true
3537

36-
check-semantic-version:
37-
name: Check semantic version
38-
if: github.repository == 'watermarkhu/mkdocstrings-matlab'
38+
setup:
3939
runs-on: ubuntu-latest
40+
permissions:
41+
contents: read
42+
outputs:
43+
python-versions: ${{ steps.get-versions.outputs.python-versions }}
4044
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
48+
- name: Get Python versions from pyproject.toml
49+
id: get-versions
50+
run: |
51+
# Extract Python versions from classifiers
52+
versions=$(grep -E "Programming Language :: Python :: 3\.[0-9]+" pyproject.toml | \
53+
sed -E 's/.*Python :: (3\.[0-9]+).*/\1/' | \
54+
sort -V | \
55+
jq -R -s -c 'split("\n")[:-1]')
56+
echo "python-versions=$versions" >> $GITHUB_OUTPUT
57+
echo "Found Python versions: $versions"
4158
42-
- name: Checkout repository
59+
test:
60+
name: Run checks and tests
61+
needs: setup
62+
permissions:
63+
contents: read
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
python-version: ${{ fromJson(needs.setup.outputs.python-versions) }}
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Checkout code
4371
uses: actions/checkout@v4
44-
with:
45-
fetch-depth: 0
46-
ref: main
4772

48-
- name: Create fake commit with PR title
49-
run: |
50-
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
51-
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
52-
git switch -c temp-${{ github.run_id }}
53-
touch temp.txt
54-
git add temp.txt
55-
git commit -m "${{ github.event.pull_request.title }}"
56-
57-
- name: Install the latest version of uv
73+
- name: Set up uv
5874
uses: astral-sh/setup-uv@v6
5975
with:
6076
version: "latest"
6177

62-
- name: Check next semantic version
78+
- name: Install dependencies
79+
run: |
80+
uv sync --all-groups --python ${{ matrix.python-version }}
81+
82+
- name: Run ruff linting
6383
run: |
64-
uv sync --dev
65-
NEXT=$(uv run semantic-release --noop version --print-tag)
66-
CURRENT=$(uv run semantic-release --noop version --print-last-released-tag)
67-
echo "$NEXT"
68-
if [ "$NEXT" = "$CURRENT" ]; then
69-
echo "comment=No release will be made." >> $GITHUB_ENV
84+
echo "## 🔍 Ruff Linting Results" >> $GITHUB_STEP_SUMMARY
85+
if uv run ruff check --output-format=github .; then
86+
echo "✅ No linting errors found" >> $GITHUB_STEP_SUMMARY
7087
else
71-
echo "comment=The next release will be $NEXT" >> $GITHUB_ENV
88+
echo "❌ Linting errors found" >> $GITHUB_STEP_SUMMARY
89+
exit 1
7290
fi
7391
74-
- name: Find Comment
75-
id: fc
76-
uses: peter-evans/find-comment@v3
77-
with:
78-
issue-number: ${{ github.event.pull_request.number }}
79-
comment-author: 'github-actions[bot]'
80-
body-includes: This comment was written by a bot!
92+
- name: Run ruff formatting check
93+
run: |
94+
echo "## 🎨 Code Formatting Check" >> $GITHUB_STEP_SUMMARY
95+
if uv run ruff format --check .; then
96+
echo "✅ Code formatting is correct" >> $GITHUB_STEP_SUMMARY
97+
else
98+
echo "❌ Code formatting issues found" >> $GITHUB_STEP_SUMMARY
99+
exit 1
100+
fi
81101
82-
- name: Create comment
83-
if: steps.fc.outputs.comment-id == ''
84-
uses: peter-evans/create-or-update-comment@v4
85-
with:
86-
issue-number: ${{ github.event.pull_request.number }}
87-
body: |
88-
${{ env.comment }}
89-
<!-- This comment was written by a bot! -->
90-
91-
- name: Update comment
92-
if: steps.fc.outputs.comment-id != ''
93-
uses: peter-evans/create-or-update-comment@v4
102+
- name: Run Ty type checking
103+
run: |
104+
echo "## 🔧 Ty Type Checking Results" >> $GITHUB_STEP_SUMMARY
105+
if uv run ty check; then
106+
echo "✅ No type errors found" >> $GITHUB_STEP_SUMMARY
107+
else
108+
echo "❌ Type errors found" >> $GITHUB_STEP_SUMMARY
109+
exit 1
110+
fi
111+
112+
- name: Run tests
113+
run: |
114+
if uv run pytest --cov mkdocstrings_handlers.matlab --tb=short -v --junit-xml=pytest.xml; then
115+
echo '# ✅ Tests passed' >> $GITHUB_STEP_SUMMARY
116+
else
117+
echo '# ❌ Tests failed' >> $GITHUB_STEP_SUMMARY
118+
exit 1
119+
fi
120+
121+
- name: Generate test coverage report
122+
if: (!cancelled())
123+
run: |
124+
echo '### Test Coverage Summary' >> $GITHUB_STEP_SUMMARY
125+
uv run coverage report --show-missing --format=markdown >> $GITHUB_STEP_SUMMARY
126+
127+
- name: Upload Test Results
128+
if: (!cancelled())
129+
uses: actions/upload-artifact@v4
94130
with:
95-
comment-id: ${{ steps.fc.outputs.comment-id }}
96-
edit-mode: replace
97-
body: |
98-
${{ env.comment }}
99-
<!-- This comment was written by a bot! -->
131+
name: Test Results (Python ${{ matrix.python-version }})
132+
path: pytest.xml
133+
134+
summary:
135+
runs-on: ubuntu-latest
136+
needs: [setup, test]
137+
if: (!cancelled())
138+
permissions:
139+
contents: read
140+
pull-requests: write
141+
checks: write
142+
steps:
143+
- name: Download Artifacts
144+
uses: actions/download-artifact@v4
145+
with:
146+
path: artifacts
147+
148+
- name: Publish Test Results
149+
uses: EnricoMi/publish-unit-test-result-action@v2
150+
with:
151+
files: "artifacts/**/*.xml"
152+
153+
- name: Check all jobs
154+
run: |
155+
if [[ "${{ needs.test.result }}" == "success" ]]; then
156+
echo "✅ All Python versions passed CI checks"
157+
echo "## 🎉 CI Summary" >> $GITHUB_STEP_SUMMARY
158+
echo "All tests passed across Python versions: ${{ needs.setup.outputs.python-versions }}" >> $GITHUB_STEP_SUMMARY
159+
else
160+
echo "❌ Some Python versions failed CI checks"
161+
echo "## ❌ CI Summary" >> $GITHUB_STEP_SUMMARY
162+
echo "Some tests failed. Check individual job results for details." >> $GITHUB_STEP_SUMMARY
163+
exit 1
164+
fi

0 commit comments

Comments
 (0)