Skip to content

Commit

Permalink
Merge pull request #3927 from ethereum/fix-testgen-action
Browse files Browse the repository at this point in the history
Fix test vector generators to work with Python 3.12
  • Loading branch information
hwwhww authored Sep 18, 2024
2 parents 666b63a + 36da776 commit c8ba4d2
Show file tree
Hide file tree
Showing 24 changed files with 22 additions and 53 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/generate_vectors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ on:

jobs:
generate-tests:
runs-on: [self-hosted-ghr-custom, size-chungus-x64, profile-consensusSpecs]
runs-on: [self-hosted-ghr-custom, size-xl-x64, profile-consensusSpecs]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: 'ethereum/consensus-specs'
path: 'consensus-specs'
ref: ${{ inputs.source_ref || 'dev' }}
ref: ${{ inputs.ref || 'dev' }}
- name: Checkout consensus-spec-tests repository
uses: actions/checkout@v4
with:
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ dist_check:
dist_upload:
python3 -m twine upload dist/*

build_wheel: install_test pyspec
. venv/bin/activate && \
python3 -m build --no-isolation --outdir ./dist ./

# "make generate_tests" to run all generators
generate_tests: $(GENERATOR_TARGETS)
Expand Down Expand Up @@ -195,7 +198,8 @@ define run_generator
cd $(GENERATOR_DIR)/$(1); \
if ! test -d venv; then python3 -m venv venv; fi; \
. venv/bin/activate; \
pip3 install -r requirements.txt; \
pip3 install ../../../dist/eth2spec-*.whl; \
pip3 install 'eth2spec[generator]'; \
python3 main.py -o $(CURRENT_DIR)/$(TEST_VECTOR_DIR); \
echo "generator $(1) finished"
endef
Expand All @@ -217,7 +221,7 @@ gen_kzg_setups:

# For any generator, build it using the run_generator function.
# (creation of output dir is a dependency)
gen_%: $(TEST_VECTOR_DIR)
gen_%: build_wheel $(TEST_VECTOR_DIR)
$(call run_generator,$*)

detect_generator_incomplete: $(TEST_VECTOR_DIR)
Expand Down
3 changes: 2 additions & 1 deletion requirements_preinstallation.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pip>=24.0.0
wheel>=0.44.0
setuptools>=72.0.0
pylint>=3.2.0
pylint>=3.2.0
build>=1.2.2
20 changes: 12 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,26 +524,30 @@ def run(self):
long_description=readme,
long_description_content_type="text/markdown",
author="ethereum",
url="https://github.com/ethereum/eth2.0-specs",
url="https://github.com/ethereum/consensus-specs",
include_package_data=False,
package_data={'configs': ['*.yaml'],
'presets': ['*.yaml'],
'specs': ['**/*.md'],
'eth2spec': ['VERSION.txt']},
package_data={
'configs': ['*.yaml'],
'eth2spec': ['VERSION.txt'],
'presets': ['**/*.yaml', '**/*.json'],
'specs': ['**/*.md'],
'sync': ['optimistic.md'],
},
package_dir={
"eth2spec": "tests/core/pyspec/eth2spec",
"configs": "configs",
"eth2spec": "tests/core/pyspec/eth2spec",
"presets": "presets",
"specs": "specs",
"sync": "sync",
},
packages=find_packages(where='tests/core/pyspec') + ['configs', 'specs'],
packages=find_packages(where='tests/core/pyspec') + ['configs', 'presets', 'specs', 'presets', 'sync'],
py_modules=["eth2spec"],
cmdclass=commands,
python_requires=">=3.9, <4",
extras_require={
"test": ["pytest>=4.4", "pytest-cov", "pytest-xdist"],
"lint": ["flake8==5.0.4", "mypy==0.981", "pylint==2.15.3"],
"generator": ["python-snappy==0.6.1", "filelock", "pathos==0.3.0"],
"generator": ["setuptools>=72.0.0", "pytest>4.4", "python-snappy==0.7.3", "filelock", "pathos==0.3.0"],
"docs": ["mkdocs==1.4.2", "mkdocs-material==9.1.5", "mdx-truly-sane-lists==1.3", "mkdocs-awesome-pages-plugin==2.8.0"]
},
install_requires=[
Expand Down
2 changes: 0 additions & 2 deletions tests/generators/bls/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/epoch_processing/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/finality/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/fork_choice/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/forks/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/genesis/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/kzg_4844/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/kzg_7594/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/light_client/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/merkle_proof/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/networking/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/operations/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/random/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/rewards/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/sanity/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/shuffling/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/ssz_generic/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/ssz_static/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/sync/requirements.txt

This file was deleted.

2 changes: 0 additions & 2 deletions tests/generators/transition/requirements.txt

This file was deleted.

0 comments on commit c8ba4d2

Please sign in to comment.