Skip to content

Commit

Permalink
Merge branch 'dev' into pr3255
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed Oct 10, 2023
2 parents baaab93 + b044303 commit f958c5f
Show file tree
Hide file tree
Showing 178 changed files with 9,787 additions and 2,853 deletions.
64 changes: 48 additions & 16 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,31 @@ commands:
steps:
- restore_cached_venv:
venv_name: v24-pyspec
reqs_checksum: cache-{{ checksum "setup.py" }}
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}
save_pyspec_cached_venv:
description: Save a venv into a cache with pyspec keys"
steps:
- save_cached_venv:
venv_name: v24-pyspec
reqs_checksum: cache-{{ checksum "setup.py" }}
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}
venv_path: ./venv
restore_deposit_contract_tester_cached_venv:
description: "Restore the venv from cache for the deposit contract tester"
steps:
- restore_cached_venv:
venv_name: v23-deposit-contract-tester
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
save_deposit_contract_tester_cached_venv:
description: "Save the venv to cache for later use of the deposit contract tester"
steps:
- save_cached_venv:
venv_name: v23-deposit-contract-tester
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
reqs_checksum: cache-{{ checksum "setup.py" }}-{{ checksum "requirements_preinstallation.txt" }}-{{ checksum "solidity_deposit_contract/web3_tester/requirements.txt" }}
venv_path: ./solidity_deposit_contract/web3_tester/venv
jobs:
checkout_specs:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
# Restore git repo at point close to target branch/revision, to speed up checkout
Expand All @@ -80,7 +80,7 @@ jobs:
- ~/specs-repo
install_pyspec_test:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand All @@ -92,7 +92,7 @@ jobs:
- save_pyspec_cached_venv
test-phase0:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand All @@ -105,7 +105,7 @@ jobs:
path: tests/core/pyspec/test-reports
test-altair:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand All @@ -118,7 +118,7 @@ jobs:
path: tests/core/pyspec/test-reports
test-bellatrix:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand All @@ -131,7 +131,7 @@ jobs:
path: tests/core/pyspec/test-reports
test-capella:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand All @@ -144,7 +144,7 @@ jobs:
path: tests/core/pyspec/test-reports
test-deneb:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand All @@ -155,6 +155,32 @@ jobs:
command: make citest fork=deneb
- store_test_results:
path: tests/core/pyspec/test-reports
test-eip6110:
docker:
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
- restore_pyspec_cached_venv
- run:
name: Run py-tests
command: make citest fork=eip6110
- store_test_results:
path: tests/core/pyspec/test-reports
test-eip7002:
docker:
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
key: v3-specs-repo-{{ .Branch }}-{{ .Revision }}
- restore_pyspec_cached_venv
- run:
name: Run py-tests
command: make citest fork=eip7002
- store_test_results:
path: tests/core/pyspec/test-reports
table_of_contents:
docker:
- image: circleci/node:10.16.3
Expand All @@ -163,10 +189,10 @@ jobs:
- checkout
- run:
name: Check table of contents
command: sudo npm install -g doctoc@2 && make check_toc
command: sudo npm install -g doctoc@2.2.0 && make check_toc
codespell:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- checkout
Expand All @@ -175,7 +201,7 @@ jobs:
command: pip install 'codespell<3.0.0,>=2.0.0' --user && make codespell
lint:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand Down Expand Up @@ -231,7 +257,7 @@ jobs:
- /nix
install_deposit_contract_web3_tester:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand All @@ -243,7 +269,7 @@ jobs:
- save_deposit_contract_tester_cached_venv
test_deposit_contract_web3_tests:
docker:
- image: circleci/python:3.8
- image: circleci/python:3.9
working_directory: ~/specs-repo
steps:
- restore_cache:
Expand Down Expand Up @@ -275,6 +301,12 @@ workflows:
- test-deneb:
requires:
- install_pyspec_test
- test-eip6110:
requires:
- install_pyspec_test
- test-eip7002:
requires:
- install_pyspec_test
- table_of_contents
- codespell
- lint:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

name: Publish docs
on:
push:
branches:
- master
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build docs
run: make copy_docs
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v2
with:
key: ${{ github.ref }}
path: .cache
- run: pip install mkdocs==1.4.2 mkdocs-material==9.1.5 mdx-truly-sane-lists==1.3 mkdocs-awesome-pages-plugin==2.8.0
- run: mkdocs gh-deploy --force
20 changes: 3 additions & 17 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ defaults:

env:
TEST_PRESET_TYPE: "minimal"
DEFAULT_BRANCH: "dev"

# Run tests on workflow_Dispatch
on:
on:
push:
branches:
- dev
Expand All @@ -22,10 +20,6 @@ on:
description: Type of test to run, either mainnet or minimal
type: string
required: true
commitRef:
description: The branch, tag or SHA to checkout and build from
default: dev
required: true
schedule:
- cron: '0 0 * * *'

Expand All @@ -47,19 +41,15 @@ jobs:
steps:
- name: Checkout this repo
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: Check table of contents
run: sudo npm install -g doctoc@2 && make check_toc
run: sudo npm install -g doctoc@2.2.0 && make check_toc

codespell:
runs-on: self-hosted
needs: preclear
steps:
- name: Checkout this repo
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: Check codespell
run: pip install 'codespell<3.0.0,>=2.0.0' --user && make codespell

Expand All @@ -69,8 +59,6 @@ jobs:
steps:
- name: Checkout this repo
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: Install pyspec requirements
run: make install_test
- name: Run linter for pyspec
Expand All @@ -83,12 +71,10 @@ jobs:
needs: [preclear,lint,codespell,table_of_contents]
strategy:
matrix:
version: ["phase0", "altair", "bellatrix", "capella", "deneb"]
version: ["phase0", "altair", "bellatrix", "capella", "deneb", "eip6110", "eip7002"]
steps:
- name: Checkout this repo
uses: actions/[email protected]
with:
ref: ${{ github.event.inputs.commitRef || env.DEFAULT_BRANCH }}
- name: set TEST_PRESET_TYPE
if: github.event.inputs.test_preset_type != ''
run: |
Expand Down
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ venv
.venvs
.venv
/.pytest_cache
*.swp

build/
output/
Expand All @@ -20,6 +21,9 @@ tests/core/pyspec/eth2spec/altair/
tests/core/pyspec/eth2spec/bellatrix/
tests/core/pyspec/eth2spec/capella/
tests/core/pyspec/eth2spec/deneb/
tests/core/pyspec/eth2spec/eip6110/
tests/core/pyspec/eth2spec/eip7002/
tests/core/pyspec/eth2spec/whisk/

# coverage reports
.htmlcov
Expand All @@ -34,3 +38,11 @@ tests/core/pyspec/eth2spec/test_results.xml

# TOC tool outputs temporary files
*.tmp

# docs reader build
docs/specs
docs/sync
docs/ssz
docs/fork_choice
docs/README.md
site
41 changes: 36 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ GENERATORS = $(sort $(dir $(wildcard $(GENERATOR_DIR)/*/.)))
# Map this list of generator paths to "gen_{generator name}" entries
GENERATOR_TARGETS = $(patsubst $(GENERATOR_DIR)/%/, gen_%, $(GENERATORS))
GENERATOR_VENVS = $(patsubst $(GENERATOR_DIR)/%, $(GENERATOR_DIR)/%venv, $(GENERATORS))
# Documents
DOCS_DIR = ./docs
SSZ_DIR = ./ssz
SYNC_DIR = ./sync
FORK_CHOICE_DIR = ./fork_choice

# To check generator matching:
#$(info $$GENERATOR_TARGETS is [${GENERATOR_TARGETS}])
Expand All @@ -29,7 +34,7 @@ MARKDOWN_FILES = $(wildcard $(SPEC_DIR)/*/*.md) \
$(wildcard $(SPEC_DIR)/_features/*/*/*.md) \
$(wildcard $(SSZ_DIR)/*.md)

ALL_EXECUTABLE_SPECS = phase0 altair bellatrix capella deneb
ALL_EXECUTABLE_SPECS = phase0 altair bellatrix capella deneb eip6110 whisk
# The parameters for commands. Use `foreach` to avoid listing specs again.
COVERAGE_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPECS), --cov=eth2spec.$S.$(TEST_PRESET_TYPE))
PYLINT_SCOPE := $(foreach S,$(ALL_EXECUTABLE_SPECS), ./eth2spec/$S)
Expand Down Expand Up @@ -99,9 +104,15 @@ generate_tests: $(GENERATOR_TARGETS)
pyspec:
python3 -m venv venv; . venv/bin/activate; python3 setup.py pyspecdev

# check the setup tool requirements
preinstallation:
python3 -m venv venv; . venv/bin/activate; \
python3 -m pip install -r requirements_preinstallation.txt

# installs the packages to run pyspec tests
install_test:
python3 -m venv venv; . venv/bin/activate; python3 -m pip install -e .[lint]; python3 -m pip install -e .[test]
install_test: preinstallation
python3 -m venv venv; . venv/bin/activate; \
python3 -m pip install -e .[lint]; python3 -m pip install -e .[test]

# Testing against `minimal` or `mainnet` config by default
test: pyspec
Expand Down Expand Up @@ -141,8 +152,8 @@ codespell:
lint: pyspec
. venv/bin/activate; cd $(PY_SPEC_DIR); \
flake8 --config $(LINTER_CONFIG_FILE) ./eth2spec \
&& pylint --rcfile $(LINTER_CONFIG_FILE) $(PYLINT_SCOPE) \
&& mypy --config-file $(LINTER_CONFIG_FILE) $(MYPY_SCOPE)
&& python -m pylint --rcfile $(LINTER_CONFIG_FILE) $(PYLINT_SCOPE) \
&& python -m mypy --config-file $(LINTER_CONFIG_FILE) $(MYPY_SCOPE)

lint_generators: pyspec
. venv/bin/activate; cd $(TEST_GENERATORS_DIR); \
Expand Down Expand Up @@ -214,3 +225,23 @@ detect_generator_incomplete: $(TEST_VECTOR_DIR)

detect_generator_error_log: $(TEST_VECTOR_DIR)
[ -f $(GENERATOR_ERROR_LOG_FILE) ] && echo "[ERROR] $(GENERATOR_ERROR_LOG_FILE) file exists" || echo "[PASSED] error log file does not exist"


# For docs reader
install_docs:
python3 -m venv venv; . venv/bin/activate; python3 -m pip install -e .[docs];

copy_docs:
cp -r $(SPEC_DIR) $(DOCS_DIR);
cp -r $(SYNC_DIR) $(DOCS_DIR);
cp -r $(SSZ_DIR) $(DOCS_DIR);
cp -r $(FORK_CHOICE_DIR) $(DOCS_DIR);
cp $(CURRENT_DIR)/README.md $(DOCS_DIR)/README.md

build_docs: copy_docs
. venv/bin/activate;
mkdocs build

serve_docs:
. venv/bin/activate;
mkdocs serve
Loading

0 comments on commit f958c5f

Please sign in to comment.