-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d6665c5
commit bcfe88d
Showing
8 changed files
with
207 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
name: Aderyn-py | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install git submodules | ||
run: | | ||
git submodule update --init --recursive | ||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
reports: | ||
name: Check Reports | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: foundry-toolchain | ||
uses: foundry-rs/[email protected] | ||
|
||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
cache: "pip" | ||
|
||
- name: Submodule init | ||
run: | | ||
git submodule update --init --recursive | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: "npm" | ||
|
||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
|
||
- uses: bahmutov/npm-install@v1 | ||
with: | ||
useLockFile: false | ||
working-directory: tests/2024-05-Sablier/v2-core | ||
|
||
- uses: bahmutov/npm-install@v1 | ||
with: | ||
useLockFile: false | ||
working-directory: tests/prb-math/ | ||
|
||
- name: Setup virtual environment | ||
run: | | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install -r ./aderyn_py/requirements.txt | ||
- name: Run tests | ||
run: | | ||
source venv/bin/activate | ||
cd aderyn_py | ||
maturin develop | ||
pytest tests |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pytest==8.3.2 | ||
maturin==1.7.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import subprocess | ||
import pytest | ||
from aderynpy import generate_report | ||
|
||
@pytest.mark.parametrize("root, report", [ | ||
("../tests/contract-playground", "../reports/report.md"), | ||
("../tests/2024-05-Sablier", "../reports/sablier-aderyn-toml-nested-root.md"), | ||
("../tests/adhoc-sol-files", "../reports/adhoc-sol-files-report.md"), | ||
("../tests/foundry-nft-f23", "../reports/nft-report.md"), | ||
("../tests/prb-math", "../reports/prb-math-report.md"), | ||
]) | ||
def test_generate_report(root, report): | ||
# Define output file path | ||
out_file = f"./{root.split('../')[-1]}-workflow.md" | ||
|
||
# Call the generate_report function | ||
generate_report(root, out_file) | ||
|
||
# Run the diff command to compare the generated report with the original report | ||
result = subprocess.run( | ||
["diff", str(out_file), report], | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
) | ||
|
||
# Check if diff command found any differences (result.returncode == 0 means no differences) | ||
assert result.returncode == 1 |