Skip to content

Commit

Permalink
Try Windows
Browse files Browse the repository at this point in the history
kick cache

Cache string
  • Loading branch information
hwwhww committed May 23, 2020
1 parent 37b9650 commit b105e46
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 14 deletions.
22 changes: 19 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ tox_common: &tox_common
steps:
- checkout
- restore_cache:
keys:
- venv-deps1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
key: tox-deps2-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
- run:
name: install dependencies
command: pip install --user tox
Expand All @@ -17,8 +16,10 @@ tox_common: &tox_common
paths:
- .tox
- ./eggs
key: venv-deps1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}
key: tox-deps2-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements.txt" }}-{{ checksum "requirements_test.txt" }}-{{ checksum "setup.py" }}

orbs:
win: circleci/[email protected] # The Windows orb give you everything you need to start using the Windows executor.

jobs:
venv_build:
Expand Down Expand Up @@ -75,6 +76,7 @@ jobs:
- image: circleci/python:3.8
environment:
TOXENV: py38-core
# Linux
tox-py37-script:
<<: *tox_common
docker:
Expand All @@ -87,6 +89,19 @@ jobs:
- image: circleci/python:3.8
environment:
TOXENV: py38-script
# Windows
win-py37-script:
executor:
name: win/default
shell: powershell.exe
steps:
- checkout
- run:
name: Install testing requirements on Windows"
command: python -m pip install -r requirements_test.txt
- run:
name: Run deposit script on Windows"
command: python ./test_deposit_script.py

workflows:
version: 2.1
Expand All @@ -103,3 +118,4 @@ workflows:
- tox-py38-core
- tox-py37-script
- tox-py38-script
- win-py37-script
3 changes: 3 additions & 0 deletions deposit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ case "$(uname -s)" in

CYGWIN*|MINGW32*|MSYS*|MINGW*)
echo 'MS Windows'
python -m pip install -r requirements.txt
python setup.py install
python ./eth2deposit/deposit.py "$@"
;;

*)
Expand Down
12 changes: 9 additions & 3 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ py==1.8.1 \
zipp==3.1.0 \
--hash=sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b \
--hash=sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96
pyparsing==2.4.6 \
--hash=sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f \
--hash=sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec
pyparsing==2.4.7 \
--hash=sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b \
--hash=sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1
colorama==0.4.3 \
--hash=sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff \
--hash=sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1
atomicwrites==1.4.0 \
--hash=sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197 \
--hash=sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a
21 changes: 18 additions & 3 deletions test_deposit_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,25 @@ async def main():
if not os.path.exists(my_folder_path):
os.mkdir(my_folder_path)

if os.name == 'nt': # Windows
script = 'sh deposit.sh'
else:
script = './deposit.sh'

cmd_args = [
'./deposit.sh',
script,
'--num_validators', '1',
'--mnemonic_language', 'english',
'--password', 'MyPassword',
'--folder', my_folder_path,
]
print('[INFO] Creating subprocess')
proc = await asyncio.create_subprocess_shell(
' '.join(cmd_args),
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)

seed_phrase = ''
parsing = False
async for out in proc.stdout:
Expand All @@ -39,6 +45,10 @@ async def main():
proc.stdin.write(b'\n')
print(output)

async for out in proc.stderr:
output = out.decode('utf-8').rstrip()
print(f'[stderr] {output}')

assert len(seed_phrase) > 0

# Check files
Expand All @@ -52,4 +62,9 @@ async def main():
os.rmdir(my_folder_path)


asyncio.run(main())
if os.name == 'nt': # Windows
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
loop.run_until_complete(main())
else:
asyncio.run(main())
10 changes: 5 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ deps=
-r{toxinidir}/requirements.txt
-r{toxinidir}/requirements_test.txt

[common-pytest]
[common-core]
deps={[common-install]deps}
commands=
pytest {posargs:tests}
Expand All @@ -36,12 +36,12 @@ commands=
python {toxinidir}/test_deposit_script.py

[testenv:py37-core]
deps={[common-pytest]deps}
commands={[common-pytest]commands}
deps={[common-core]deps}
commands={[common-core]commands}

[testenv:py38-core]
deps={[common-pytest]deps}
commands={[common-pytest]commands}
deps={[common-core]deps}
commands={[common-core]commands}

[testenv:py37-lint]
deps={[common-lint]deps}
Expand Down

0 comments on commit b105e46

Please sign in to comment.