Skip to content

Commit

Permalink
improve artifact name
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed May 22, 2024
1 parent b3c6261 commit cfc7488
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,14 @@ jobs:
- name: Upload bytecode
uses: actions/upload-artifact@v2
with:
name: vyper-bytecode
name: "vyper-bytecode-\
${{ matrix.os && matrix.os != 'ubuntu' && format('{0}-', matrix.os) || '' }}\
py${{ matrix.python-version[1] || '311' }}\
-opt-${{ matrix.opt-mode || 'gas' }}\
${{ matrix.debug && '-debug' || '' }}\
${{ matrix.experimental-codegen && '-experimental' || '' }}\
-${{ matrix.evm-version || 'cancun' }}\
-${{ matrix.evm-backend || 'revm' }}"
path: /tmp/vyper-bytecode

- name: Upload Coverage
Expand Down
14 changes: 6 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,7 @@ def tracing(pytestconfig):

@pytest.fixture(scope="session")
def export_bytecode_path(pytestconfig):
path = pytestconfig.getoption("export_bytecode")
if path:
path = Path(path)
path.mkdir(exist_ok=True)
return path
return pytestconfig.getoption("export_bytecode")


@pytest.fixture
Expand Down Expand Up @@ -238,20 +234,22 @@ def compiler_settings(optimize, experimental_codegen, evm_version, debug):

@pytest.fixture(scope="module")
def get_contract(env, optimize, output_formats, compiler_settings, export_bytecode_path, request):
index = 0
index = 0 # for exporting multiple files from the same test file, this fixture has module scope

def fn(source_code, *args, **kwargs):
if "override_opt_level" in kwargs:
kwargs["compiler_settings"] = Settings(
**dict(compiler_settings.__dict__, optimize=kwargs.pop("override_opt_level"))
)

if export_bytecode_path:
nonlocal index
filename = Path(request.node.nodeid).with_suffix(f".{index:02d}.json")
export_path = export_bytecode_path / filename
name = Path(request.node.nodeid).with_suffix(f".{index:02d}.json")
export_path = Path(export_bytecode_path) / name
export_path.parent.mkdir(parents=True, exist_ok=True)
kwargs["export_file"] = export_path
index += 1

return env.deploy_source(source_code, output_formats, *args, **kwargs)

return fn
Expand Down

0 comments on commit cfc7488

Please sign in to comment.