Skip to content

Commit 1f4abf5

Browse files
authored
Merge pull request #52 from jamesob/jamesob-22-01-single-file
Remove compilation step
2 parents 8ca3c13 + 73a3227 commit 1f4abf5

File tree

19 files changed

+172
-3674
lines changed

19 files changed

+172
-3674
lines changed

.github/workflows/run-tests.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,23 @@ jobs:
2323
- name: Install test dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
pip install -r src/requirements-dev.txt
26+
pip install -r requirements-dev.txt
27+
cp coldcore coldcore.py
28+
echo "PYTHONPATH=$(pwd)" >> $GITHUB_ENV
2729
2830
- name: black
29-
run: black --check
31+
run: black --check coldcore
3032

3133
- name: flake8
3234
run: |
33-
flake8 src --count --show-source --statistics --exclude 'test_*'
35+
flake8 coldcore --count --show-source --statistics
3436
# When linting the tests, ignore long line errors
35-
flake8 src --count --show-source --statistics --ignore E501
37+
flake8 test/ --count --show-source --statistics --ignore E501
3638
3739
- name: pytest
3840
run: |
39-
pytest -vv src
41+
pytest -vv test/
4042
4143
- name: mypy
4244
run: |
43-
mypy src/coldcore
44-
45-
- name: check compiled script
46-
run: |
47-
python ./bin/compile
48-
git diff --exit-code
49-
./coldcore --help
45+
mypy coldcore

Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Dockerfile for running tests/lints
2+
FROM docker.io/library/python:latest
3+
4+
WORKDIR /src
5+
COPY ./requirements-dev.txt .
6+
RUN pip install -r requirements-dev.txt

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
install:
2+
install -m755 coldcore /usr/local/bin/coldcore
13

2-
coldcore:
3-
./bin/compile
4+
docker-build:
5+
docker build --tag coldcore/test .
46

5-
test:
6-
pytest src/coldcore
7+
test: docker-build
8+
docker run -v ./coldcore:/src/coldcore.py -e PYTHONPATH=/src -v ./:/src:ro coldcore/test pytest -vv --color=yes test/
79

8-
.PHONY: test
10+
lint: docker-build
11+
docker run --rm -v ./:/src:ro coldcore/test flake8 coldcore
12+
docker run --rm -v ./:/src:ro coldcore/test black --check coldcore
13+
docker run --rm -v ./:/src:ro coldcore/test mypy coldcore
14+
15+
.PHONY: docker-build lint test

README.md

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ by doing a few test transactions in testnet.
9595
set `coldcard --rpc <url>` if desired.
9696

9797

98+
### Development
99+
100+
Run tests and linting locally with `make test` and `make lint`. It's advisable to do
101+
this before filing a PR, otherwise CI will likely fail due to [`black` formatting
102+
requirements](https://github.com/psf/black).
103+
104+
98105
## Design
99106

100107
### Zero install process
@@ -143,37 +150,7 @@ supported, but I'm happy to add others that fit the criteria of
143150

144151
### Auditing
145152

146-
The final script, `coldcore`, is dumbly compiled from the contents of `src/coldcore/`
147-
for convenience during development (per `./bin/compile`).
148-
149-
If you want to read through, I recommend starting with the `src/coldcore` tree.
150-
151-
```
152-
.
153-
├── bin
154-
│   ├── compile # generates final `coldcore` script
155-
│   └── sign_release
156-
├── coldcore
157-
├── sigs # signatures for verification
158-
│   └── coldcore-0.1.0-alpha.asc
159-
└── src
160-
├── coldcore
161-
│   ├── crypto.py # a few basic cryptographic utilities
162-
│   ├── __init__.py
163-
│   ├── main.py # most logic is here; wallet ops, CLI, models
164-
│   ├── test_coldcard.py
165-
│   ├── test_crypto.py
166-
│   ├── thirdparty
167-
│   │   ├── bitcoin_rpc.py # taken from python-bitcoinlib
168-
│   │   ├── clii.py # taken from jamesob/clii
169-
│   │   ├── __init__.py
170-
│   │   └── py.typed
171-
│   └── ui.py # presentation logic, curses
172-
├── requirements-dev.txt
173-
└── setup.py # for development use only
174-
```
175-
176-
153+
All source is contained in `coldcore`.
177154

178155
## Status
179156

bin/compile

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

0 commit comments

Comments
 (0)