Skip to content

Commit 6d48160

Browse files
committed
[ci] Test new ci/cd
1 parent 60685bf commit 6d48160

File tree

3 files changed

+189
-23
lines changed

3 files changed

+189
-23
lines changed
Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,50 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
4-
name: Python package
1+
name: CI
52

63
on:
74
push:
8-
branches: [ "main" ]
5+
branches: [ "main", "feature/*" ]
96
pull_request:
107
branches: [ "main" ]
118
workflow_dispatch:
129

1310
jobs:
14-
build:
15-
16-
runs-on: ubuntu-latest
11+
test:
12+
runs-on: ${{ matrix.os }}
1713
strategy:
1814
fail-fast: false
1915
matrix:
16+
os: [ubuntu-latest, windows-latest, macos-latest]
2017
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2118

2219
steps:
2320
- uses: actions/checkout@v4
21+
2422
- name: Set up Python ${{ matrix.python-version }}
25-
uses: actions/setup-python@v3
23+
uses: actions/setup-python@v5
2624
with:
2725
python-version: ${{ matrix.python-version }}
26+
2827
- name: Install dependencies
2928
run: |
3029
python -m pip install --upgrade pip
31-
python -m pip install flake8 pytest
3230
pip install -e .[dev]
33-
- name: Lint with flake8
31+
32+
- name: Lint with ruff
3433
run: |
35-
# stop the build if there are Python syntax errors or undefined names
36-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
34+
ruff check .
35+
ruff format --check .
36+
37+
- name: Type check with pyrefly
38+
run: |
39+
pyrefly
40+
3941
- name: Test with pytest
4042
run: |
41-
pytest
43+
pytest --cov=kicad_lib_manager --cov-report=xml
44+
45+
- name: Upload coverage to Codecov
46+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
47+
uses: codecov/codecov-action@v4
48+
with:
49+
file: ./coverage.xml
50+
fail_ci_if_error: false

.github/workflows/release.yml

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., v0.3.1)'
11+
required: true
12+
type: string
13+
14+
permissions:
15+
contents: write
16+
id-token: write
17+
18+
jobs:
19+
build-and-publish:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.11'
31+
32+
- name: Install build dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install build hatch
36+
37+
- name: Verify version matches tag
38+
run: |
39+
if [[ "${{ github.event_name }}" == "push" ]]; then
40+
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
41+
else
42+
TAG_VERSION="${{ github.event.inputs.version }}"
43+
TAG_VERSION="${TAG_VERSION#v}"
44+
fi
45+
46+
PACKAGE_VERSION=$(python -c "import kicad_lib_manager; print(kicad_lib_manager.__version__)")
47+
48+
if [[ "$TAG_VERSION" != "$PACKAGE_VERSION" ]]; then
49+
echo "Version mismatch: tag=$TAG_VERSION, package=$PACKAGE_VERSION"
50+
exit 1
51+
fi
52+
53+
echo "VERSION=$TAG_VERSION" >> $GITHUB_ENV
54+
55+
- name: Run tests
56+
run: |
57+
pip install -e .[dev]
58+
ruff check .
59+
ruff format --check .
60+
pyrefly
61+
pytest
62+
63+
- name: Build package
64+
run: |
65+
python -m build
66+
67+
- name: Check package
68+
run: |
69+
pip install twine
70+
twine check dist/*
71+
72+
- name: Generate release notes
73+
id: release_notes
74+
env:
75+
GH_TOKEN: ${{ github.token }}
76+
run: |
77+
# Get the previous release tag
78+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
79+
80+
if [ -z "$PREVIOUS_TAG" ]; then
81+
# First release, get all commits
82+
COMMITS=$(git log --oneline --no-merges)
83+
else
84+
# Get commits since last release
85+
COMMITS=$(git log --oneline --no-merges ${PREVIOUS_TAG}..HEAD)
86+
fi
87+
88+
# Get PR information
89+
PRS=$(gh pr list --state merged --search "merged:>${PREVIOUS_TAG:-1970-01-01}" --json number,title,url --jq '.[] | "- #\(.number): \(.title) (\(.url))"' 2>/dev/null || echo "")
90+
91+
# Generate release notes
92+
cat > release_notes.md << EOF
93+
## What's Changed in v${VERSION}
94+
95+
### Commits
96+
$(echo "$COMMITS" | sed 's/^/- /')
97+
98+
EOF
99+
100+
if [ ! -z "$PRS" ]; then
101+
cat >> release_notes.md << EOF
102+
103+
### Pull Requests
104+
$(echo "$PRS")
105+
106+
EOF
107+
fi
108+
109+
cat >> release_notes.md << 'EOF'
110+
111+
### Installation
112+
113+
**Using pipx (recommended for CLI tools):**
114+
```bash
115+
pipx install kilm
116+
```
117+
118+
**Using pip:**
119+
```bash
120+
pip install kilm
121+
```
122+
123+
**From release assets:**
124+
1. Download the wheel file from this release
125+
2. Install with pipx or pip:
126+
```bash
127+
pipx install kilm-${VERSION}-py3-none-any.whl
128+
# or
129+
pip install kilm-${VERSION}-py3-none-any.whl
130+
```
131+
132+
### Auto-Update (Coming Soon)
133+
Future versions will include `kilm update` functionality for easy updates.
134+
EOF
135+
136+
# Store release notes for next step
137+
echo "release_notes<<EOF" >> $GITHUB_OUTPUT
138+
cat release_notes.md >> $GITHUB_OUTPUT
139+
echo "EOF" >> $GITHUB_OUTPUT
140+
141+
- name: Create GitHub Release
142+
uses: softprops/action-gh-release@v2
143+
with:
144+
tag_name: ${{ github.event_name == 'push' && github.ref_name || format('v{0}', github.event.inputs.version) }}
145+
name: Release ${{ github.event_name == 'push' && github.ref_name || format('v{0}', github.event.inputs.version) }}
146+
body: ${{ steps.release_notes.outputs.release_notes }}
147+
draft: true
148+
prerelease: false
149+
files: |
150+
dist/*.whl
151+
dist/*.tar.gz
152+
153+
- name: Publish to PyPI
154+
uses: pypa/gh-action-pypi-publish@release/v1
155+
with:
156+
print-hash: true
157+
verbose: true

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Professional command-line tool for managing KiCad libraries across projects and workstations.
1010

11-
**[📚 Official Documentation](https://kilm.aristovnik.me)**
11+
**[Official Documentation](https://kilm.aristovnik.me)**
1212

1313
## Features
1414

@@ -41,18 +41,18 @@ kilm setup
4141
kilm status
4242
```
4343

44-
> **📚 [Complete Installation Guide](https://kilm.aristovnik.me/guides/installation/)** - Multiple installation methods, verification steps, and troubleshooting.
44+
> **[Complete Installation Guide](https://kilm.aristovnik.me/guides/installation/)** - Multiple installation methods, verification steps, and troubleshooting.
4545
4646
## Documentation
4747

48-
**[📚 Complete Documentation](https://kilm.aristovnik.me)**
48+
**[Complete Documentation](https://kilm.aristovnik.me)**
4949

5050
| Guide | Description |
5151
|-------|-------------|
52-
| [🚀 Getting Started](https://kilm.aristovnik.me/guides/getting-started/) | Creator and consumer workflows with Git integration |
53-
| [⚙️ Configuration](https://kilm.aristovnik.me/guides/configuration/) | KiLM and KiCad configuration management |
54-
| [📖 CLI Reference](https://kilm.aristovnik.me/reference/cli/) | Complete command documentation with examples |
55-
| [🛠️ Development](https://kilm.aristovnik.me/community/development/) | Setup guide for contributors and development |
52+
| [Getting Started](https://kilm.aristovnik.me/guides/getting-started/) | Creator and consumer workflows with Git integration |
53+
| [Configuration](https://kilm.aristovnik.me/guides/configuration/) | KiLM and KiCad configuration management |
54+
| [CLI Reference](https://kilm.aristovnik.me/reference/cli/) | Complete command documentation with examples |
55+
| [Development](https://kilm.aristovnik.me/community/development/) | Setup guide for contributors and development |
5656

5757
## License
5858

0 commit comments

Comments
 (0)