Skip to content

Commit c6bb7d4

Browse files
authored
Merge pull request #39 from VaitaR/dev
Dev
2 parents 8a57d75 + 923bee0 commit c6bb7d4

134 files changed

Lines changed: 12200 additions & 13024 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/README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# GitHub Actions Workflows
2+
3+
## Overview
4+
5+
This project uses a simplified two-workflow strategy optimized for Python packages with Rust extensions.
6+
7+
## Workflows
8+
9+
### 1. ci.yml - Code Quality (Runs on every push/PR)
10+
11+
**Purpose**: Fast feedback on code quality
12+
13+
**Jobs**:
14+
- **lint** - Pre-commit hooks, mypy type checking, import-linter
15+
- **test** - Pytest across Python 3.10, 3.11, 3.12 with coverage
16+
17+
**Does NOT**:
18+
- Build wheels (too slow, not needed on every push)
19+
- Publish to PyPI (only on release)
20+
21+
**Runtime**: ~3-5 minutes
22+
23+
---
24+
25+
### 2. wheels.yml - Build & Publish (Runs on release)
26+
27+
**Purpose**: Build production wheels and publish to PyPI
28+
29+
**Triggers**:
30+
- On release creation (automatic)
31+
- Manual workflow dispatch (for testing)
32+
33+
**Jobs**:
34+
- **build_wheels** - Uses cibuildwheel for Linux, Windows, macOS
35+
- **build_sdist** - Source distribution
36+
- **publish** - Publishes to PyPI (only on release)
37+
38+
**Does**:
39+
- Builds wheels with maturin (Rust extension)
40+
- Tests each wheel after building
41+
- Handles cross-platform builds
42+
- Publishes to PyPI with trusted publishing
43+
44+
**Runtime**: ~20-30 minutes (cross-platform builds)
45+
46+
---
47+
48+
## Why This Structure?
49+
50+
### Problems with Previous Setup
51+
- Had 3 workflows, 2 were failing with maturin errors
52+
- Attempted to build wheels on every push (slow, unnecessary)
53+
- Duplicated testing across workflows
54+
55+
### Current Benefits
56+
1. **Fast CI** - Code quality checks in minutes, not hours
57+
2. **Reliable** - No maturin builds in CI (only on release with proper tooling)
58+
3. **Standard Practice** - Follows Python+Rust project conventions
59+
4. **Clear Separation** - Code quality vs distribution packaging
60+
61+
## Development Workflow
62+
63+
### Daily Development
64+
```bash
65+
# Make changes
66+
git commit -m "feat: add new feature"
67+
git push
68+
69+
# CI runs:
70+
# ✓ Lint (pre-commit, mypy, import-linter)
71+
# ✓ Test (pytest on Python 3.10, 3.11, 3.12)
72+
# → ~3-5 minutes
73+
```
74+
75+
### Creating a Release
76+
```bash
77+
# Create release on GitHub
78+
gh release create v0.5.0 --generate-notes
79+
80+
# wheels.yml runs automatically:
81+
# ✓ Build wheels (Linux, Windows, macOS)
82+
# ✓ Build sdist
83+
# ✓ Test wheels
84+
# ✓ Publish to PyPI
85+
# → ~20-30 minutes
86+
```
87+
88+
## Testing Installation Locally
89+
90+
### Editable Install (Development)
91+
```bash
92+
# No wheel needed, no maturin required
93+
pip install -e .
94+
python -c "import aiochainscan"
95+
```
96+
97+
### Test Wheel Build (Before Release)
98+
```bash
99+
# Requires Rust toolchain
100+
pip install maturin
101+
maturin develop
102+
```
103+
104+
### Test From GitHub (Any Branch)
105+
```bash
106+
pip install git+https://github.com/VaitaR/aiochainscan.git@develop
107+
```
108+
109+
## Troubleshooting
110+
111+
### CI Failing on Lint
112+
- Run `pre-commit run --all-files` locally
113+
- Fix issues, commit, push
114+
115+
### CI Failing on Tests
116+
- Run `pytest` locally
117+
- Check test output for failures
118+
119+
### Wheels Failing to Build
120+
- Check Rust is installed: `rustc --version`
121+
- Check maturin version: `pip show maturin` (should be ≥1.8)
122+
- Test locally: `maturin build --release`
123+
124+
## Related Documentation
125+
126+
- [CI_SIMPLIFICATION.md](../../docs/CI_SIMPLIFICATION.md) - Why we simplified
127+
- [PYPI_PUBLISHING.md](../../docs/PYPI_PUBLISHING.md) - Publishing guide
128+
- [CONTRIBUTING.md](../../CONTRIBUTING.md) - Development guide

.github/workflows/ci.yml

Lines changed: 4 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ jobs:
4040
- name: Install dependencies
4141
run: uv sync --extra dev --frozen
4242

43+
# Run import tests FIRST to catch circular dependencies early
44+
- name: Test imports (catch circular deps)
45+
run: uv run pytest tests/test_imports.py -v --tb=short
46+
4347
- name: Run pre-commit (all files)
4448
run: uv run pre-commit run --all-files --show-diff-on-failure
4549

@@ -82,65 +86,3 @@ jobs:
8286

8387
- name: Run tests
8488
run: uv run pytest --cov=aiochainscan --cov-report=xml --cov-report=term-missing
85-
86-
87-
88-
build:
89-
name: Build Package
90-
runs-on: ubuntu-latest
91-
needs: [lint, test]
92-
steps:
93-
- name: Checkout code
94-
uses: actions/checkout@v4
95-
96-
- name: Install uv
97-
uses: astral-sh/setup-uv@v4
98-
with:
99-
version: "latest"
100-
101-
- name: Cache uv packages
102-
uses: actions/cache@v4
103-
with:
104-
path: |
105-
~/.cache/uv
106-
~/.local/share/uv
107-
key: ${{ runner.os }}-uv-${{ env.PYTHON_VERSION }}-${{ hashFiles('uv.lock') }}
108-
restore-keys: |
109-
${{ runner.os }}-uv-${{ env.PYTHON_VERSION }}-
110-
111-
- name: Set up Python
112-
run: uv python install ${{ env.PYTHON_VERSION }}
113-
114-
- name: Install dependencies
115-
run: uv sync --extra dev --frozen
116-
117-
- name: Build package
118-
run: uv build
119-
120-
- name: Upload build artifacts
121-
uses: actions/upload-artifact@v4
122-
with:
123-
name: dist
124-
path: dist/
125-
126-
publish:
127-
name: Publish to PyPI
128-
runs-on: ubuntu-latest
129-
needs: build
130-
if: github.event_name == 'release' && github.event.action == 'published'
131-
environment: pypi
132-
permissions:
133-
id-token: write
134-
contents: read
135-
136-
steps:
137-
- name: Download build artifacts
138-
uses: actions/download-artifact@v4
139-
with:
140-
name: dist
141-
path: dist/
142-
143-
- name: Publish to PyPI
144-
uses: pypa/gh-action-pypi-publish@release/v1
145-
with:
146-
verbose: true

.github/workflows/test-install.yml

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)