Skip to content

Commit

Permalink
Merge pull request #8 from qtumproject/cf/merge-upstream-2.3.1
Browse files Browse the repository at this point in the history
merge upstream 2.3.1
  • Loading branch information
qtum-neil authored Sep 21, 2023
2 parents b02e4e5 + 879be3d commit a69f718
Show file tree
Hide file tree
Showing 255 changed files with 20,218 additions and 6,910 deletions.
142 changes: 107 additions & 35 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
container:
dockerfile: ci/cirrus.Dockerfile

env:
EMAIL: [email protected]

python_version_matrix_template: &PYTHON_VERSION_MATRIX_TEMPLATE
- container:
dockerfile: ci/py37.Dockerfile
env:
PYTHON: 3.7
- container:
dockerfile: ci/cirrus.Dockerfile
env:
PYTHON: 3.8
- container:
dockerfile: ci/py39.Dockerfile
env:
PYTHON: 3.9
- container:
dockerfile: ci/py310.Dockerfile
env:
PYTHON: 3.10
- container:
dockerfile: ci/py311.Dockerfile
env:
PYTHON: 3.11

device_matrix_template: &DEVICE_MATRIX_TEMPLATE
- env:
DEVICE: --trezor-1
Expand Down Expand Up @@ -54,8 +73,37 @@ device_matrix_template: &DEVICE_MATRIX_TEMPLATE
- tar -xvf "mcu.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --jade
depends_on:
- Jade Sim Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Jade Sim Builder/sim/jade.tar.gz"
- tar -xvf "jade.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
- env:
DEVICE: --ledger
depends_on:
- Ledger Sim Builder
- Ledger App Builder
- dist_builder
- bitcoind_builder
fetch_sim_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Ledger Sim Builder/sim/speculos.tar.gz"
- tar -xvf "speculos.tar.gz"
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
fetch_ledger_app_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/Ledger App Builder/built_ledger_app/app-bitcoin-new/bin/app.elf"
- mv app.elf test/work/speculos/apps/btc-test.elf
sim_install_script:
- poetry run pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- env:
DEVICE: --ledger-legacy
depends_on:
- Ledger Sim Builder
- dist_builder
Expand All @@ -66,8 +114,8 @@ device_matrix_template: &DEVICE_MATRIX_TEMPLATE
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"
sim_install_script:
- poetry run pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests
- pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests
- poetry run pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- pip install construct flask-restful jsonschema mnemonic pyelftools pillow requests pytesseract
- env:
DEVICE: --keepkey
depends_on:
Expand All @@ -80,12 +128,11 @@ device_matrix_template: &DEVICE_MATRIX_TEMPLATE
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/bitcoind_builder/bitcoin/bitcoin.tar.gz"
- tar -xvf "bitcoin.tar.gz"

lint_task:
test_script:
- flake8

task:
container:
image: python:latest
install_script:
- pip install poetry
- poetry install
matrix:
- name: Type Check
Expand All @@ -102,6 +149,7 @@ task:
hwilib/devices/bitbox02.py
hwilib/devices/coldcard.py
hwilib/devices/digitalbitbox.py
hwilib/devices/jade.py
hwilib/devices/__init__.py
hwilib/devices/keepkey.py
hwilib/devices/ledger.py
Expand All @@ -116,15 +164,19 @@ task:
hwilib/udevinstaller.py
- name: Non-Device Tests
test_script: cd test; poetry run ./run_tests.py; cd ..
- name: lint
test_script: poetry run flake8

wine_builder_task:
container:
dockerfile: contrib/build.Dockerfile
dockerfile: contrib/build-wine.Dockerfile
build_script:
- contrib/build_wine.sh
- find dist -type f -exec sha256sum {} \;

bitcoind_builder_task:
container:
dockerfile: ci/cirrus.Dockerfile
bitcoind_cache:
folder: test/work/bitcoin
ccache_cache:
Expand All @@ -138,6 +190,8 @@ bitcoind_builder_task:
path: "bitcoin.tar.gz"

task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --trezor-1
name: Trezor 1 Sim Builder
Expand All @@ -150,6 +204,8 @@ task:
path: "trezor-firmware.tar.gz"

task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --trezor-t
name: Trezor T Sim Builder
Expand All @@ -162,6 +218,8 @@ task:
path: "trezor-firmware.tar.gz"

task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --coldcard
name: Coldcard Sim Builder
Expand All @@ -174,6 +232,8 @@ task:
path: "coldcard-mpy.tar.gz"

task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --bitbox01
name: Bitbox01 Sim Builder
Expand All @@ -186,6 +246,22 @@ task:
path: "mcu.tar.gz"

task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --jade
name: Jade Sim Builder
sim_work_cache:
folder: test/work/jade
build_script:
- cd test; ./setup_environment.sh $DEVICE; cd ..
- tar -czf jade.tar.gz test/work/jade/simulator
sim_artifacts:
path: "jade.tar.gz"

task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --ledger
name: Ledger Sim Builder
Expand All @@ -198,6 +274,8 @@ task:
path: "speculos.tar.gz"

task:
container:
dockerfile: ci/cirrus.Dockerfile
env:
DEVICE: --keepkey
name: Keepkey Sim Builder
Expand All @@ -220,20 +298,33 @@ dist_builder_task:
built_dist_artifacts:
path: "dist/*"

ledger_app_builder_task:
name: Ledger App Builder
container:
image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder:latest
build_script:
- git clone https://github.com/LedgerHQ/app-bitcoin-new.git
- cd app-bitcoin-new
- make DEBUG=1
built_ledger_app_artifacts:
path: app-bitcoin-new/bin/app.elf

task:
matrix:
<< : *PYTHON_VERSION_MATRIX_TEMPLATE
matrix:
<< : *DEVICE_MATRIX_TEMPLATE
fetch_dist_script:
- wget -nv "https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/dist_builder/built_dist.zip"
- unzip built_dist.zip
matrix:
- name: $DEVICE Wheel
- name: Python $PYTHON $DEVICE Wheel
install_script: pip install dist/*.whl
test_script: cd test; ./run_tests.py $DEVICE --interface=cli --device-only; cd ..
- name: $DEVICE Sdist
install_script: pip install $(find dist -name "*.tar.gz" -a -not -name "*amd64*")
- name: Python $PYTHON $DEVICE Sdist
install_script: pip install $(find dist -name "*.tar.gz" -a -not -name "*linux*")
test_script: cd test; ./run_tests.py $DEVICE --interface=cli --device-only; cd ..
- name: $DEVICE Bindist
- name: Python $PYTHON $DEVICE Bindist
install_script: poetry install
untar_bindist_script: cd dist; tar -xvf hwi*linux*.tar.gz; cd ..
test_script: cd test; poetry run ./run_tests.py $DEVICE --interface=bindist --device-only; cd ..
Expand All @@ -242,26 +333,8 @@ task:

task:
matrix:
- container:
dockerfile: ci/cirrus.Dockerfile
env:
PYTHON: 3.6
- container:
dockerfile: ci/py37.Dockerfile
env:
PYTHON: 3.7
- container:
dockerfile: ci/py38.Dockerfile
env:
PYTHON: 3.8
- container:
dockerfile: ci/py39.Dockerfile
env:
PYTHON: 3.9
- container:
dockerfile: ci/py310.Dockerfile
env:
PYTHON: 3.10
<< : *PYTHON_VERSION_MATRIX_TEMPLATE
install_script: poetry install
matrix:
<< : *DEVICE_MATRIX_TEMPLATE
matrix:
Expand All @@ -272,7 +345,6 @@ task:
- env:
INTERFACE: stdin
name: Python $PYTHON $DEVICE $INTERFACE
install_script: poetry install
test_script: cd test; poetry run ./run_tests.py $DEVICE --interface=$INTERFACE --device-only; cd ..
on_failure:
failed_script: tail -v -n +1 test/*.std*
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
exclude = *.pyc,__pycache__,hwilib/devices/btchip/,hwilib/devices/ckcc/,hwilib/devices/trezorlib/,test/work/,hwilib/ui
exclude = *.pyc,__pycache__,hwilib/devices/ledger_bitcoin/,hwilib/devices/btchip,hwilib/devices/ckcc/,hwilib/devices/jadepy/,hwilib/devices/trezorlib/,test/work/,hwilib/ui,hwilib/devices/bitbox02_lib
ignore = E261,E302,E305,E501,E722,W5
per-file-ignores = setup.py:E122
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.6.12
3.9
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ python3 setup.py install

## Dependencies

See `pyproject.toml` for all dependencies. Dependencies under `[tool.poetry.dependecies]` are user dependencies, and `[tool.poetry.dev-dependencies]` for development based dependencies. These dependencies will be installed with any of the three above installation methods.
See `pyproject.toml` for all dependencies. Dependencies under `[tool.poetry.dependencies]` are user dependencies, and `[tool.poetry.dev-dependencies]` for development based dependencies. These dependencies will be installed with any of the three above installation methods.

## Usage

Expand Down
18 changes: 14 additions & 4 deletions ci/cirrus.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM python:3.6
# Cache break (modify this line to break cirrus' dockerfile build cache) 1

FROM python:3.8

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
Expand All @@ -24,21 +26,28 @@ RUN apt-get install -y \
libdb-dev \
libdb++-dev \
libevent-dev \
libgcrypt20-dev \
libnewlib-arm-none-eabi \
libpcsclite-dev \
libsdl2-dev \
libsdl2-image-dev \
libssl-dev \
libslirp-dev \
libtool \
libudev-dev \
libusb-1.0-0-dev \
ninja-build \
pkg-config \
protobuf-compiler \
qemu-user-static
qemu-user-static \
swig

RUN pip install poetry flake8
RUN wget https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init
RUN chmod +x rustup-init && ./rustup-init -y
ENV PATH="/root/.cargo/bin:$PATH"
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v22.0/protoc-22.0-linux-x86_64.zip
RUN unzip protoc-22.0-linux-x86_64.zip -d /usr/local
RUN protoc --version

####################
# Local build/test steps
Expand All @@ -48,7 +57,7 @@ ENV PATH="/root/.cargo/bin:$PATH"
# as needed.
# e.g.,
# docker build -f ci/cirrus.Dockerfile -t hwi_test .
# docker run -it --entrypoint /bin/bash hwi_tst
# docker run -it --entrypoint /bin/bash hwi_test
# cd test; poetry run ./run_tests.py --ledger --coldcard --interface=cli --device-only
####################

Expand All @@ -68,6 +77,7 @@ ENV PATH="/root/.cargo/bin:$PATH"
#RUN cd test; ./setup_environment.sh --bitbox01
#RUN cd test; ./setup_environment.sh --ledger
#RUN cd test; ./setup_environment.sh --keepkey
#RUN cd test; ./setup_environment.sh --jade
#RUN cd test; ./setup_environment.sh --bitcoind
#
## Once everything has been built, put rest of files in place
Expand Down
7 changes: 6 additions & 1 deletion ci/py310.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Cache break (modify this line to break cirrus' dockerfile build cache) 1

FROM python:3.10

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y \
cython3 \
git \
libpcsclite-dev \
libsdl2-dev \
libsdl2-image-dev \
libslirp-dev \
libudev-dev \
libusb-1.0-0-dev \
qemu-user-static
qemu-user-static \
swig

RUN pip install poetry flake8

Expand Down
9 changes: 7 additions & 2 deletions ci/py38.Dockerfile → ci/py311.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
FROM python:3.8
# Cache break (modify this line to break cirrus' dockerfile build cache)

FROM python:3.11

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y \
cython3 \
git \
libpcsclite-dev \
libsdl2-dev \
libsdl2-image-dev \
libslirp-dev \
libudev-dev \
libusb-1.0-0-dev \
qemu-user-static
qemu-user-static \
swig

RUN pip install poetry flake8

Expand Down
Loading

0 comments on commit a69f718

Please sign in to comment.