diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2689374c..17e6c43a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-latest", "windows-2022"] + python: ${{ (github.event_name == 'pull_request' && fromJSON('["3.8", "3.12"]')) || fromJSON('["3.8", "3.9", "3.10", "3.11", "3.12"]') }} type: ["brownie", "buidler", "dapp", "embark", "hardhat", "solc", "truffle", "waffle", "foundry", "standard", "vyper", "solc_multi_file", "hardhat_multi_file"] exclude: # Currently broken, tries to pull git:// which is blocked by GH @@ -32,6 +33,12 @@ jobs: # Explore foundry support in windows - os: windows-2022 type: foundry + # brownie does not install correctly with Python 3.12 + - python: 3.12 + type: brownie + # TODO: review failure executing npx on Windows + - os: windows-2022 + python: 3.12 steps: - uses: actions/checkout@v4 - name: Set up shell @@ -43,15 +50,14 @@ jobs: uses: actions/setup-node@v4 with: node-version: 18.15 - - name: Set up Python 3.8 + - name: Set up Python ${{ matrix.python }} uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: ${{ matrix.python }} - name: Install dependencies run: | - pip install "solc-select>=v1.0.0b1" - solc-select use 0.5.7 --always-install pip install . + solc-select use 0.5.7 --always-install - name: Set up nix if: matrix.type == 'dapp' uses: cachix/install-nix-action@v24 diff --git a/crytic_compile/__main__.py b/crytic_compile/__main__.py index 7ee5984d..7bdad337 100644 --- a/crytic_compile/__main__.py +++ b/crytic_compile/__main__.py @@ -2,14 +2,13 @@ This is the Slither cli script """ import argparse +from importlib.metadata import version import json import logging import os import sys from typing import TYPE_CHECKING, Any, Optional -from pkg_resources import require - from crytic_compile.crytic_compile import compile_all, get_platforms from crytic_compile.cryticparser import DEFAULTS_FLAG_IN_CONFIG, cryticparser from crytic_compile.platform import InvalidCompilation @@ -109,7 +108,7 @@ def parse_args() -> argparse.Namespace: parser.add_argument( "--version", help="displays the current version", - version=require("crytic-compile")[0].version, + version=version("crytic-compile"), action="version", ) diff --git a/crytic_compile/platform/vyper.py b/crytic_compile/platform/vyper.py index 4d6fc13f..15b354af 100644 --- a/crytic_compile/platform/vyper.py +++ b/crytic_compile/platform/vyper.py @@ -206,9 +206,21 @@ def _run_vyper_standard_json( ) # convert bytestrings to unicode strings vyper_standard_output = json.loads(stdout) + if "errors" in vyper_standard_output: - # TODO format errors - raise InvalidCompilation(vyper_standard_output["errors"]) + + has_errors = False + for diagnostic in vyper_standard_output["errors"]: + + if diagnostic["severity"] == "warning": + continue + + msg = diagnostic.get("formattedMessage", diagnostic["message"]) + LOGGER.error(msg) + has_errors = True + + if has_errors: + raise InvalidCompilation("Vyper compilation errored") return vyper_standard_output