Skip to content

Commit 472d8ce

Browse files
committed
Add github workflows and clarify + clean up project info:
- Add a github workflow for CI to run tests and linting. - Clarify the linting commands and reduce the surface area of where the instructions are to the README.md, using CONTRIBUTING.md for extra contribution instructions. - Cleans up tox environment setup for better UX.
1 parent b93fb44 commit 472d8ce

File tree

7 files changed

+135
-75
lines changed

7 files changed

+135
-75
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,15 @@
1-
### What was wrong?
2-
3-
Related to Issue #
4-
5-
### How was it fixed?
6-
71
## 🗒️ Description
82
<!-- Brief description of the changes introduced by this PR -->
9-
<!-- Don't submit this PR if it could expose a mainnet bug, see SECURITY.md in the repo root for details -->
103

114
## 🔗 Related Issues or PRs
12-
<!-- Reference any related issues using the GitHub issue number (e.g., Fixes #123). Default is N/A. -->
13-
N/A.
5+
<!-- Reference any related issues using the GitHub issue number (e.g., Closes #123). Default is N/A. -->
146

157
## ✅ Checklist
168
<!-- Please check off all required items. For those that don't apply remove them accordingly. -->
179

18-
- [ ] All: Ran fast `tox` checks to avoid unnecessary CI fails:
10+
- [ ] Ran `tox` checks to avoid unnecessary CI fails:
1911
```console
20-
uvx --with=tox-uv tox -e check,pytest
12+
uvx --with=tox-uv tox
2113
```
2214
- [ ] Considered adding appropriate tests for the changes.
23-
- [ ] Considered adding an entry to [CHANGELOG.md](/ethereum/execution-spec-tests/blob/main/docs/CHANGELOG.md).
24-
- [ ] Considered updating the online docs in the [./docs/](/ethereum/execution-spec-tests/blob/main/docs/) directory.
25-
- [ ] Tests: Ran `mkdocs serve` locally and verified the auto-generated docs for new tests in the [Test Case Reference](https://eest.ethereum.org/main/tests/) are correctly formatted.
15+
- [ ] Considered updating the online docs in the [./docs/](/leanEthereum/leanSpec/tree/main/docs/) directory.

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint:
19+
name: Lint and format checks - Python ${{ matrix.python-version }}
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
python-version: ["3.12", "3.13"]
25+
steps:
26+
- name: Checkout leanSpec
27+
uses: actions/checkout@v4
28+
29+
- name: Install uv and Python ${{ matrix.python-version }}
30+
uses: astral-sh/setup-uv@v4
31+
with:
32+
enable-cache: true
33+
cache-dependency-glob: "pyproject.toml"
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Run all quality checks via tox
37+
run: uvx --with=tox-uv tox -e all-checks
38+
39+
test:
40+
name: Tests - Python ${{ matrix.python-version }} on ${{ matrix.os }}
41+
runs-on: ${{ matrix.os }}
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
os: [ubuntu-latest, macos-latest]
46+
python-version: ["3.12", "3.13"]
47+
steps:
48+
- name: Checkout leanSpec
49+
uses: actions/checkout@v4
50+
51+
- name: Install uv and Python ${{ matrix.python-version }}
52+
uses: astral-sh/setup-uv@v4
53+
with:
54+
enable-cache: true
55+
cache-dependency-glob: "pyproject.toml"
56+
python-version: ${{ matrix.python-version }}
57+
58+
- name: Run tests via tox
59+
run: uvx --with=tox-uv tox -e pytest

CLAUDE.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ uv run ruff check --fix src tests
4141
# Type checking
4242
uv run mypy src tests
4343

44-
# Run all checks via tox
45-
uvx --with=tox-uv tox
44+
# Run all quality checks (lint, typecheck, spellcheck)
45+
uv run tox -e all-checks
46+
47+
# Run everything (all checks + tests + docs)
48+
uv run tox
4649
```
4750

4851
### Common Tasks
@@ -78,17 +81,18 @@ uvx --with=tox-uv tox
7881

7982
## Common Commands Reference
8083

81-
| Task | Command |
82-
|----------------------|---------|
83-
| Install dependencies | `uv sync --all-extras` |
84-
| Run tests | `uv run pytest` |
85-
| Format code | `uv run ruff format src tests` |
86-
| Lint code | `uv run ruff check src tests` |
87-
| Fix lint errors | `uv run ruff check --fix src tests` |
88-
| Type check | `uv run mypy src tests` |
89-
| Run all tox checks | `uvx --with=tox-uv tox` |
90-
| Build docs | `uv run mkdocs build` |
91-
| Serve docs | `uv run mkdocs serve` |
84+
| Task | Command |
85+
|----------------------------------------|-------------------------------------|
86+
| Install dependencies | `uv sync --all-extras` |
87+
| Run tests | `uv run pytest` |
88+
| Format code | `uv run ruff format src tests` |
89+
| Lint code | `uv run ruff check src tests` |
90+
| Fix lint errors | `uv run ruff check --fix src tests` |
91+
| Type check | `uv run mypy src tests` |
92+
| Build docs | `uv run mkdocs build` |
93+
| Serve docs | `uv run mkdocs serve` |
94+
| Run all quality checks (no tests/docs) | `uv run tox -e all-checks` |
95+
| Run everything (checks + tests + docs) | `uv run tox` |
9296

9397
## Important Notes
9498

CONTRIBUTING.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
1. Fork and clone the repository
66
2. Install dependencies: `uv sync --all-extras`
77
3. Make your changes
8-
4. Run checks: `uvx --with=tox-uv tox -e check`
8+
4. Run checks: `uv run tox -e all-checks`
99
5. Run tests: `uv run pytest`
1010
6. Submit a pull request
1111

@@ -22,7 +22,7 @@
2222
- **Type hints**: Required for all functions and methods
2323
- **Docstrings**: Use Google style for public APIs
2424
- **Line length**: 79 characters (enforced by ruff)
25-
- **Formatting**: Run `uvx --with=tox-uv tox -e fix` to auto-format
25+
- **Formatting**: Run `uv run tox -e fix` to auto-format
2626

2727
## Adding New Subspecifications
2828

@@ -40,25 +40,8 @@ mkdir -p tests/subspecs/my_new_subspec
4040
- Use `pytest.mark.parametrize` for multiple test cases
4141
- Mark slow tests with `@pytest.mark.slow`
4242

43-
## Development Commands
44-
45-
### Running Quality Checks
46-
```bash
47-
# Run all checks
48-
uvx --with=tox-uv tox -e check,pytest
49-
50-
# Run individual checks
51-
uvx --with=tox-uv tox -e lint # Linting with ruff
52-
uvx --with=tox-uv tox -e typecheck # Type checking with mypy
53-
uvx --with=tox-uv tox -e spellcheck # Spell checking
54-
uvx --with=tox-uv tox -e pytest # Run tests
55-
56-
# Auto-fix formatting issues
57-
uvx --with=tox-uv tox -e fix
58-
```
59-
6043
## Questions?
6144

6245
- Check existing [issues](https://github.com/leanEthereum/leanSpec/issues)
6346
- Open a new issue for discussion
64-
- See [README.md](README.md) for project overview
47+
- See [README.md](README.md) for more details on the project structure and commands

README.md

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,32 @@ uv run ruff format src tests
8282
uv run mypy src tests
8383
```
8484

85-
### Using Tox
85+
### Using Tox for Comprehensive Checks
86+
87+
After running `uv sync --all-extras`, you can use tox with `uv run`:
8688

8789
```bash
88-
# Run all tox environments
89-
uvx --with=tox-uv tox
90+
# Run all quality checks (lint, typecheck, spellcheck)
91+
uv run tox -e all-checks
92+
93+
# Run all tox environments (all checks + tests + docs)
94+
uv run tox
9095

9196
# Run specific environment
92-
uvx --with=tox-uv tox -e lint
97+
uv run tox -e lint
98+
```
99+
100+
**Alternative: Using uvx (no setup required)**
101+
102+
If you haven't run `uv sync --all-extras` or want to use tox in isolation,
103+
you can use `uvx`, which:
104+
105+
* Creates a temporary environment just for tox
106+
* Doesn't require `uv sync` first
107+
* Uses tox-uv for faster dependency installation
108+
109+
```bash
110+
uvx --with=tox-uv tox -e all-checks
93111
```
94112

95113
### Documentation
@@ -153,22 +171,32 @@ def test_withdrawal_amount_above_uint64_max():
153171

154172
## Common Commands Reference
155173

156-
| Task | Command |
157-
|----------------------|---------|
158-
| Install dependencies | `uv sync --all-extras` |
159-
| Run tests | `uv run pytest` |
160-
| Format code | `uv run ruff format src tests` |
161-
| Lint code | `uv run ruff check src tests` |
162-
| Fix lint errors | `uv run ruff check --fix src tests` |
163-
| Type check | `uv run mypy src tests` |
164-
| Run all tox checks | `uvx --with=tox-uv tox` |
165-
| Build docs | `uv run mkdocs build` |
166-
| Serve docs | `uv run mkdocs serve` |
167-
174+
| Task | Command |
175+
|----------------------------------------|-------------------------------------|
176+
| Install dependencies | `uv sync --all-extras` |
177+
| Run tests | `uv run pytest` |
178+
| Format code | `uv run ruff format src tests` |
179+
| Lint code | `uv run ruff check src tests` |
180+
| Fix lint errors | `uv run ruff check --fix src tests` |
181+
| Type check | `uv run mypy src tests` |
182+
| Build docs | `uv run mkdocs build` |
183+
| Serve docs | `uv run mkdocs serve` |
184+
| Run all quality checks (no tests/docs) | `uv run tox -e all-checks` |
185+
| Run everything (checks + tests + docs) | `uv run tox` |
186+
| Run specific tox environment | `uv run tox -e lint` |
187+
188+
If you have not run `uv sync --all-extras` or want to use `tox` in isolation,
189+
you can use `uvx`:
190+
191+
| Task | Command |
192+
|-----------------------------------------|---------------------------------------|
193+
| Run all quality checks (no tests/docs) | `uvx --with=tox-uv tox -e all-checks` |
194+
| Run everything (checks + tests + docs) | `uvx --with=tox-uv tox` |
195+
| Run specific tox environment | `uvx --with=tox-uv tox -e lint` |
168196

169197
## Contributing
170198

171-
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
199+
See [CONTRIBUTING.md](CONTRIBUTING.md) for more guidelines.
172200

173201
## License
174202

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ cryptographic subspecifications.
77

88
### Lean Ethereum Specifications
99

10-
The core protocol specifications are located in `lean_spec/`.
10+
The core protocol specifications are located in `src/lean_spec/`.
1111

1212
### Cryptographic Subspecifications
1313

14-
Supporting cryptographic primitives are located in `lean_spec/subspecs/`.
14+
Supporting cryptographic primitives are located in `src/lean_spec/subspecs/`.
1515

1616
## Design Principles
1717

tox.ini

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
[tox]
22
env_list =
3-
check
4-
lint
5-
typecheck
6-
spellcheck
3+
all-checks
74
pytest
85
docs
96
skip_missing_interpreters = true
107

11-
[testenv:check]
8+
[testenv:all-checks]
129
description = Run all quality checks (lint, typecheck, spellcheck)
1310
extras =
1411
lint
1512
typecheck
1613
docs
1714
commands =
18-
ruff check --no-fix --show-fixes src tests
19-
ruff format --check src tests
20-
mypy src tests
21-
codespell src tests docs README.md CLAUDE.md --skip="*.lock,*.svg,.git,__pycache__,.mypy_cache,.pytest_cache" --ignore-words=.codespell-ignore-words.txt
15+
{[testenv:lint]commands}
16+
{[testenv:typecheck]commands}
17+
{[testenv:spellcheck]commands}
2218

2319
[testenv:lint]
2420
description = Lint and code formatting checks (ruff)

0 commit comments

Comments
 (0)