Skip to content

Commit

Permalink
Merge pull request #343 from crytic/dev
Browse files Browse the repository at this point in the history
Synchronise master with dev
  • Loading branch information
montyly authored Jan 11, 2023
2 parents 19b2f85 + aad5d41 commit c0cb4a1
Show file tree
Hide file tree
Showing 47 changed files with 1,724 additions and 1,170 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
4 changes: 2 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-2022"]
type: ["brownie", "buidler", "dapp", "embark", "etherlime", "hardhat", "solc", "truffle", "waffle", "foundry"]
type: ["brownie", "buidler", "dapp", "embark", "etherlime", "hardhat", "solc", "truffle", "waffle", "foundry", "standard"]
exclude:
# Currently broken, tries to pull git:// which is blocked by GH
- type: embark
Expand All @@ -39,17 +39,17 @@ jobs:
id: node
shell: bash
run: |
if [ ${{ matrix.type }} = etherlime ]; then
echo '::set-output name=version::10.17.0'
if [ "${{ matrix.type }}" = "etherlime" ]; then
echo 'version=10.17.0' >> "$GITHUB_OUTPUT"
else
echo '::set-output name=version::lts/*'
echo 'version=lts/*' >> "$GITHUB_OUTPUT"
fi
- name: Set up Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ steps.node.outputs.version }}
- name: Set up Python 3.8
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
Expand All @@ -59,16 +59,17 @@ jobs:
pip install .
- name: Set up nix
if: matrix.type == 'dapp'
uses: cachix/install-nix-action@v16
uses: cachix/install-nix-action@v18
- name: Set up cachix
if: matrix.type == 'dapp'
uses: cachix/cachix-action@v10
uses: cachix/cachix-action@v12
with:
name: dapp
- name: Run Tests
env:
TEST_TYPE: ${{ matrix.type }}
GITHUB_ETHERSCAN: ${{ secrets.GITHUB_ETHERSCAN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
bash "scripts/ci_test_${TEST_TYPE}.sh"
4 changes: 2 additions & 2 deletions .github/workflows/darglint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Run Tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/etherscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
echo 'C:\msys64\mingw64\bin' >> "$GITHUB_PATH"
echo 'C:\msys64\usr\bin' >> "$GITHUB_PATH"
- name: Set up Python 3.8
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout Code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Pytest

defaults:
run:
# To load bashrc
shell: bash -ieo pipefail {0}

on:
push:
branches:
- main
- dev
pull_request:
branches: [main, dev]
schedule:
# run CI every day even if no PRs/merges occur
- cron: '0 12 * * *'

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8

# Used by ci_test.sh
- name: Install dependencies
run: |
python setup.py install
pip install pytest
pip install solc-select
- name: Run Tests
run: |
pytest tests/test_metadata.py
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
*.nix
*.pyc
.idea/
crytic_compile.egg-info/
__pycache__/
*.pyc
artifacts
build/
dist/
cache
crytic_compile.egg-info/
dist/
node_modules
package-lock.json
result
7 changes: 4 additions & 3 deletions crytic_compile/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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
from crytic_compile.platform.all_export import PLATFORMS_EXPORT
from crytic_compile.utils.zip import ZIP_TYPES_ACCEPTED, save_to_zip

if TYPE_CHECKING:
Expand Down Expand Up @@ -50,8 +51,8 @@ def parse_args() -> argparse.Namespace:

parser.add_argument(
"--export-format",
help="""Export json with non crytic-compile format
(default None. Accepted: standard, solc, truffle)""",
help=f"""Export json with non crytic-compile format
(default None. Accepted: ({", ".join(list(PLATFORMS_EXPORT))})""",
action="store",
dest="export_format",
default=None,
Expand Down Expand Up @@ -172,7 +173,7 @@ def _print_filenames(compilation: "CryticCompile") -> None:
"""
for compilation_id, compilation_unit in compilation.compilation_units.items():
print(
f"Compilation unit: {compilation_id} ({len(compilation_unit.contracts_names)} files, solc {compilation_unit.compiler_version.version})"
f"Compilation unit: {compilation_id} solc {compilation_unit.compiler_version.version})"
)
for filename, contracts in compilation_unit.filename_to_contracts.items():
for contract in contracts:
Expand Down
Loading

0 comments on commit c0cb4a1

Please sign in to comment.