mirror of
https://gitlab.com/pulsechaincom/staking-deposit-cli.git
synced 2024-12-22 19:50:34 +00:00
Update script and readme
1. deposit.sh two steps: (i) install (ii) run tool 2. Update readme for all known usages
This commit is contained in:
parent
b105e464c7
commit
10080093b6
@ -5,7 +5,7 @@ tox_common: &tox_common
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: tox-deps2-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
key: tox-deps3-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
- run:
|
||||
name: install dependencies
|
||||
command: pip install --user tox
|
||||
@ -16,12 +16,13 @@ tox_common: &tox_common
|
||||
paths:
|
||||
- .tox
|
||||
- ./eggs
|
||||
key: tox-deps2-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
key: tox-deps3-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
|
||||
orbs:
|
||||
win: circleci/windows@2.2.0 # The Windows orb give you everything you need to start using the Windows executor.
|
||||
|
||||
jobs:
|
||||
# Job(s) with Linux OS
|
||||
venv_build:
|
||||
docker:
|
||||
- image: circleci/python:3.8
|
||||
@ -29,12 +30,12 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
- run:
|
||||
name: Install requirements in venv
|
||||
command: make venv_build_test
|
||||
- save_cache:
|
||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
paths:
|
||||
- ./venv
|
||||
venv_pytest:
|
||||
@ -44,7 +45,7 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
- run:
|
||||
name: Run tests with venv
|
||||
command: make venv_test
|
||||
@ -60,7 +61,7 @@ jobs:
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: venv-deps1-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
key: venv-deps2-{{ arch }}-{{ .Branch }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
|
||||
- run:
|
||||
name: Run linter with venv
|
||||
command: make venv_lint
|
||||
@ -76,7 +77,6 @@ jobs:
|
||||
- image: circleci/python:3.8
|
||||
environment:
|
||||
TOXENV: py38-core
|
||||
# Linux
|
||||
tox-py37-script:
|
||||
<<: *tox_common
|
||||
docker:
|
||||
@ -89,7 +89,7 @@ jobs:
|
||||
- image: circleci/python:3.8
|
||||
environment:
|
||||
TOXENV: py38-script
|
||||
# Windows
|
||||
# Job(s) with Windows OS
|
||||
win-py37-script:
|
||||
executor:
|
||||
name: win/default
|
||||
|
1
Makefile
1
Makefile
@ -22,6 +22,7 @@ clean:
|
||||
|
||||
$(VENV_NAME)/bin/activate: requirements.txt
|
||||
@test -d $(VENV_NAME) || python3 -m venv --clear $(VENV_NAME)
|
||||
${VENV_NAME}/bin/python setup.py install
|
||||
${VENV_NAME}/bin/python -m pip install -r requirements.txt
|
||||
${VENV_NAME}/bin/python -m pip install -r requirements_test.txt
|
||||
@touch $(VENV_NAME)/bin/activate
|
||||
|
90
README.md
90
README.md
@ -1,13 +1,101 @@
|
||||
# eth2.0-deposit-cli
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
|
||||
|
||||
- [Tutorial for users](#tutorial-for-users)
|
||||
- [Requirements](#requirements)
|
||||
- [For Linux or MacOS users](#for-linux-or-macos-users)
|
||||
- [Step 1. Install deposit-cli dependencies](#step-1-install-deposit-cli-dependencies)
|
||||
- [Step 2. Create your keys and deposit data](#step-2-create-your-keys-and-deposit-data)
|
||||
- [For Windows users](#for-windows-users)
|
||||
- [Step 1. Install deposit-cli dependencies](#step-1-install-deposit-cli-dependencies-1)
|
||||
- [Step 2. Create your keys and deposit data](#step-2-create-your-keys-and-deposit-data-1)
|
||||
- [For `venv` users](#for-venv-users)
|
||||
- [Development](#development)
|
||||
- [Install basic requirements](#install-basic-requirements)
|
||||
- [Install testing requirements](#install-testing-requirements)
|
||||
- [Run tests](#run-tests)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
## Tutorial for users
|
||||
|
||||
### Create deposits
|
||||
### Requirements
|
||||
|
||||
- [Python **3.7+**](https://www.python.org/about/gettingstarted/)
|
||||
- [pip3](https://pip.pypa.io/en/stable/installing/)
|
||||
|
||||
### For Linux or MacOS users
|
||||
|
||||
#### Step 1. Install deposit-cli dependencies
|
||||
|
||||
If it's your first time to use this tool, you need to install the Python library dependencies:
|
||||
|
||||
```sh
|
||||
./deposit.sh install
|
||||
```
|
||||
|
||||
#### Step 2. Create your keys and deposit data
|
||||
|
||||
Run the following command:
|
||||
|
||||
```sh
|
||||
./deposit.sh
|
||||
```
|
||||
|
||||
You can also run the tool with optional arguments:
|
||||
|
||||
```sh
|
||||
./deposit.sh --num_validators=<NUM_VALIDATORS> --mnemonic_language=english --password=<YOUR_PASSWORD> --folder=<YOUR_FOLDER_PATH>
|
||||
```
|
||||
|
||||
### For Windows users
|
||||
|
||||
#### Step 1. Install deposit-cli dependencies
|
||||
|
||||
If it's your first time to use this tool, you need to install the Python library dependencies:
|
||||
|
||||
```sh
|
||||
sh deposit.sh install
|
||||
```
|
||||
|
||||
#### Step 2. Create your keys and deposit data
|
||||
|
||||
Run the following command:
|
||||
|
||||
```sh
|
||||
sh deposit.sh
|
||||
```
|
||||
|
||||
You can also run the tool with optional arguments:
|
||||
|
||||
```sh
|
||||
sh deposit.sh --num_validators=<NUM_VALIDATORS> --mnemonic_language=english --password=<YOUR_PASSWORD> --folder=<YOUR_FOLDER_PATH>
|
||||
```
|
||||
|
||||
You should see the following messages after successfully generated the keystore(s) and the deposit(s):
|
||||
|
||||
```
|
||||
Creating your keys.
|
||||
Saving your keystore(s).
|
||||
Creating your deposit(s).
|
||||
Verifying your keystore(s).
|
||||
Verifying your deposit(s).
|
||||
|
||||
Success!
|
||||
Your keys can be found at: <YOUR_FOLDER_PATH>
|
||||
```
|
||||
|
||||
### For `venv` users
|
||||
|
||||
If you want to use Python [`venv`](https://docs.python.org/3.7/library/venv.html), just run:
|
||||
|
||||
```sh
|
||||
make venv_deposit
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Install basic requirements
|
||||
|
38
deposit.sh
38
deposit.sh
@ -1,30 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
case "$(uname -s)" in
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]] || [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
echo $OSTYPE
|
||||
|
||||
Darwin)
|
||||
echo 'Mac OS X'
|
||||
python3 -m pip install -r requirements.txt
|
||||
if [[ $1 == install ]]; then
|
||||
python3 -m pip3 install -r requirements.txt
|
||||
python3 setup.py install
|
||||
python3 ./eth2deposit/deposit.py "$@"
|
||||
;;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Linux)
|
||||
echo 'Linux'
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 setup.py install
|
||||
python3 ./eth2deposit/deposit.py "$@"
|
||||
;;
|
||||
python3 ./eth2deposit/deposit.py "$@"
|
||||
|
||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||
echo 'MS Windows'
|
||||
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]]; then
|
||||
echo $OSTYPE
|
||||
if [[ $1 == install ]]; then
|
||||
python -m pip install -r requirements.txt
|
||||
python setup.py install
|
||||
python ./eth2deposit/deposit.py "$@"
|
||||
;;
|
||||
exit 1
|
||||
fi
|
||||
|
||||
*)
|
||||
echo 'Other OS'
|
||||
;;
|
||||
python ./eth2deposit/deposit.py "$@"
|
||||
|
||||
esac
|
||||
else
|
||||
echo "Sorry, to run deposit-cli on" $(uname -s)", please see the trouble-shooting on https://github.com/ethereum/eth2.0-deposit-cli"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
@ -12,7 +12,7 @@ async def main():
|
||||
|
||||
if os.name == 'nt': # Windows
|
||||
script = 'sh deposit.sh'
|
||||
else:
|
||||
else: # Mac or Linux
|
||||
script = './deposit.sh'
|
||||
|
||||
cmd_args = [
|
||||
|
@ -47,6 +47,12 @@ async def test_script():
|
||||
if not os.path.exists(my_folder_path):
|
||||
os.mkdir(my_folder_path)
|
||||
|
||||
proc = await asyncio.create_subprocess_shell(
|
||||
'./deposit.sh install',
|
||||
stdin=asyncio.subprocess.PIPE,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
)
|
||||
|
||||
cmd_args = [
|
||||
'./deposit.sh',
|
||||
'--num_validators', '1',
|
||||
|
8
tox.ini
8
tox.ini
@ -12,19 +12,15 @@ extras = test
|
||||
basepython=
|
||||
py37: python3.7
|
||||
py38: python3.8
|
||||
|
||||
[common-install]
|
||||
deps=
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/requirements_test.txt
|
||||
|
||||
[common-core]
|
||||
deps={[common-install]deps}
|
||||
commands=
|
||||
pytest {posargs:tests}
|
||||
|
||||
[common-lint]
|
||||
deps={[common-install]deps}
|
||||
commands=
|
||||
flake8 --config={toxinidir}/flake8.ini {toxinidir}/cli {toxinidir}/tests
|
||||
mypy --config-file {toxinidir}/mypy.ini -p eth2deposit
|
||||
@ -36,19 +32,15 @@ commands=
|
||||
python {toxinidir}/test_deposit_script.py
|
||||
|
||||
[testenv:py37-core]
|
||||
deps={[common-core]deps}
|
||||
commands={[common-core]commands}
|
||||
|
||||
[testenv:py38-core]
|
||||
deps={[common-core]deps}
|
||||
commands={[common-core]commands}
|
||||
|
||||
[testenv:py37-lint]
|
||||
deps={[common-lint]deps}
|
||||
commands={[common-lint]commands}
|
||||
|
||||
[testenv:py38-lint]
|
||||
deps={[common-lint]deps}
|
||||
commands={[common-lint]commands}
|
||||
|
||||
[testenv:py37-script]
|
||||
|
Loading…
Reference in New Issue
Block a user