From 157acfafc61b1afbcb137dd419b957286aff10b9 Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 24 Jan 2025 14:36:05 -0600 Subject: [PATCH 1/9] fix: handle forks --- .github/workflows/commitlint.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml index bd6c21f349..0bc5ee5140 100644 --- a/.github/workflows/commitlint.yaml +++ b/.github/workflows/commitlint.yaml @@ -12,7 +12,9 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: + ref: ${{ github.event.pull_request.head.ref }} # Checkout the branch of the PR. + repository: ${{ github.event.pull_request.head.repo.full_name }} # Handles forks. - name: Setup Python uses: actions/setup-python@v5 From dfd76b4b0578b5a54b2d0054f3e27a0551125970 Mon Sep 17 00:00:00 2001 From: antazoey Date: Fri, 24 Jan 2025 15:57:56 -0600 Subject: [PATCH 2/9] fix: only check commits from PR --- .github/workflows/commitlint.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml index 0bc5ee5140..32554cbb03 100644 --- a/.github/workflows/commitlint.yaml +++ b/.github/workflows/commitlint.yaml @@ -12,9 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: - ref: ${{ github.event.pull_request.head.ref }} # Checkout the branch of the PR. - repository: ${{ github.event.pull_request.head.repo.full_name }} # Handles forks. + fetch-depth: 0 - name: Setup Python uses: actions/setup-python@v5 @@ -26,5 +24,11 @@ jobs: python -m pip install --upgrade pip pip install -r cz-requirement.txt + - name: Get base and head commits + id: commits + run: | + echo "BASE_SHA=$(git merge-base origin/${{ github.event.pull_request.base.ref }} HEAD)" >> $GITHUB_ENV + echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Check commit history - run: cz check --rev-range $(git rev-list --all --reverse | head -1)..HEAD + run: cz check --rev-range $BASE_SHA..$HEAD_SHA From 2925290cd334ec57c017ff21a235ba03c1e4ff60 Mon Sep 17 00:00:00 2001 From: antazoey Date: Mon, 27 Jan 2025 16:12:49 -0600 Subject: [PATCH 3/9] fix: use amanns --- .github/workflows/commitlint.yaml | 58 ++++++++++++++----------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml index 32554cbb03..9be589907c 100644 --- a/.github/workflows/commitlint.yaml +++ b/.github/workflows/commitlint.yaml @@ -1,34 +1,30 @@ -on: push +name: Validate PR metadata -name: Commit Message +on: + pull_request: + types: + - opened + - edited + - synchronize -# NOTE: Skip check on PR so as not to confuse contributors -# NOTE: Also install a PR title checker so we don't mess up merges -jobs: - commit-msg: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" +permissions: + pull-requests: read - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r cz-requirement.txt - - - name: Get base and head commits - id: commits - run: | - echo "BASE_SHA=$(git merge-base origin/${{ github.event.pull_request.base.ref }} HEAD)" >> $GITHUB_ENV - echo "HEAD_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV - - - name: Check commit history - run: cz check --rev-range $BASE_SHA..$HEAD_SHA +jobs: + validate-pr: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + name: Run conventional commit checker + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + with: + types: | + feat + perf + fix + chore + refactor + docs + test From 978bcf18e170e21165099299d9b810212f557309 Mon Sep 17 00:00:00 2001 From: antazoey Date: Tue, 28 Jan 2025 15:41:01 -0600 Subject: [PATCH 4/9] chore: del cz file --- cz-requirement.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 cz-requirement.txt diff --git a/cz-requirement.txt b/cz-requirement.txt deleted file mode 100644 index 0933570909..0000000000 --- a/cz-requirement.txt +++ /dev/null @@ -1 +0,0 @@ -commitizen>=2.40,<2.41 From fcd5436a2d9626beeadd1fa8d884e7fb542c3354 Mon Sep 17 00:00:00 2001 From: antazoey Date: Tue, 28 Jan 2025 15:48:43 -0600 Subject: [PATCH 5/9] fix: rm dup and fix setup --- .github/workflows/prtitle.yaml | 30 ------------------------------ setup.py | 3 +-- 2 files changed, 1 insertion(+), 32 deletions(-) delete mode 100644 .github/workflows/prtitle.yaml diff --git a/.github/workflows/prtitle.yaml b/.github/workflows/prtitle.yaml deleted file mode 100644 index 62b1b0a4bb..0000000000 --- a/.github/workflows/prtitle.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: PR Title - -on: - pull_request_target: - types: - - opened - - edited - - synchronize - -jobs: - pr-title: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.10" - - - name: Install Dependencies - run: | - python -m pip install --upgrade pip - pip install -r cz-requirement.txt - - - name: Check PR Title - env: - TITLE: ${{ github.event.pull_request.title }} - run: cz check --message "$TITLE" diff --git a/setup.py b/setup.py index e4ddb91fb2..3e010e8722 100644 --- a/setup.py +++ b/setup.py @@ -49,8 +49,7 @@ "twine==3.8.0", # Package upload tool ], "dev": [ - # commitizen: Manage commits and publishing releases - (_HERE / "cz-requirement.txt").read_text().strip(), + "commitizen>=2.40,<2.41", # Semantic commit linting "pre-commit", # Ensure that linters are run prior to committing "pytest-watch", # `ptw` test watcher/runner "ipdb", # Debugger (Must use `export PYTHONBREAKPOINT=ipdb.set_trace`) From 14fa6f961329197ae6c7f2896095f7094cc8a6f3 Mon Sep 17 00:00:00 2001 From: antazoey Date: Tue, 28 Jan 2025 15:57:16 -0600 Subject: [PATCH 6/9] test: stupid test shut up --- tests/functional/test_proxy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_proxy.py b/tests/functional/test_proxy.py index 50aaa594ce..55a053717c 100644 --- a/tests/functional/test_proxy.py +++ b/tests/functional/test_proxy.py @@ -5,7 +5,8 @@ """ -def test_minimal_proxy(ethereum, minimal_proxy, chain): +def test_minimal_proxy(ethereum, minimal_proxy_container, chain, owner): + minimal_proxy = owner.deploy(minimal_proxy_container, sender=owner) chain.provider.network.__dict__["explorer"] = None # Ensure no explorer, messes up test. actual = ethereum.get_proxy_info(minimal_proxy.address) assert actual is not None From 9d3a518dfde82c70b6553f103432a970ff54c646 Mon Sep 17 00:00:00 2001 From: antazoey Date: Tue, 28 Jan 2025 16:28:25 -0600 Subject: [PATCH 7/9] test: idfk --- tests/functional/test_proxy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_proxy.py b/tests/functional/test_proxy.py index 55a053717c..bfba771dd4 100644 --- a/tests/functional/test_proxy.py +++ b/tests/functional/test_proxy.py @@ -6,13 +6,18 @@ def test_minimal_proxy(ethereum, minimal_proxy_container, chain, owner): + placeholder = "0xBEbeBeBEbeBebeBeBEBEbebEBeBeBebeBeBebebe" + if placeholder in chain.contracts: + del chain.contracts[placeholder] + minimal_proxy = owner.deploy(minimal_proxy_container, sender=owner) chain.provider.network.__dict__["explorer"] = None # Ensure no explorer, messes up test. actual = ethereum.get_proxy_info(minimal_proxy.address) assert actual is not None assert actual.type == ProxyType.Minimal # It is the placeholder value still. - assert actual.target == "0xBEbeBeBEbeBebeBeBEBEbebEBeBeBebeBeBebebe" + assert actual.target == placeholder + # Show getting the contract using the proxy address. contract = chain.contracts.instance_at(minimal_proxy.address) assert contract.contract_type.abi == [] # No target ABIs; no proxy ABIs either. From 7468922a7adc16cbec6383bc43c9b5b7021262a9 Mon Sep 17 00:00:00 2001 From: antazoey Date: Tue, 28 Jan 2025 17:07:01 -0600 Subject: [PATCH 8/9] test: am so ma --- tests/functional/test_proxy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/functional/test_proxy.py b/tests/functional/test_proxy.py index bfba771dd4..74168a5b3e 100644 --- a/tests/functional/test_proxy.py +++ b/tests/functional/test_proxy.py @@ -20,4 +20,7 @@ def test_minimal_proxy(ethereum, minimal_proxy_container, chain, owner): # Show getting the contract using the proxy address. contract = chain.contracts.instance_at(minimal_proxy.address) - assert contract.contract_type.abi == [] # No target ABIs; no proxy ABIs either. + abi = contract.contract_type.abi + if isinstance(abi, list): + assert abi == [] + # else: is messed up from other test (xdist). From 82bc368052bd78fc35f1899bf4104c2a7edcc6a7 Mon Sep 17 00:00:00 2001 From: antazoey Date: Tue, 28 Jan 2025 17:09:26 -0600 Subject: [PATCH 9/9] test: set abi --- tests/functional/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 20f1557459..c8ca706759 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -639,6 +639,7 @@ def fn(name="mock"): mock.tracked_settings = [] mock.ast = None mock.pcmap = None + mock.abi = [] def mock_compile(paths, project=None, settings=None): settings = settings or {}