diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 67dfe125..c8c8fbf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,9 @@ on: jobs: check: runs-on: ubuntu-latest + defaults: + run: + working-directory: pragma-oracle steps: - uses: actions/checkout@v3 - uses: software-mansion/setup-scarb@v1 diff --git a/.github/workflows/gas_reports.yml b/.github/workflows/gas_reports.yml index 961cc78c..8f7ab261 100644 --- a/.github/workflows/gas_reports.yml +++ b/.github/workflows/gas_reports.yml @@ -28,7 +28,7 @@ jobs: run: | EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - result=$(python scripts/gas_usage/compare_snapshot.py| sed 's/\x1b\[[0-9;]*m//g') + result=$(python pragma-deployer/pragma_deployer/gas_usage/compare_snapshot.py| sed 's/\x1b\[[0-9;]*m//g') result=$(echo "$result" | grep -v "Archive:") result=$(echo "$result" | grep -v "inflating:") echo "$result" > temp_result.txt diff --git a/pragma-deployer/pragma_deployer/gas_usage/compare_snapshot.py b/pragma-deployer/pragma_deployer/gas_usage/compare_snapshot.py index eb126f81..86a6a4c1 100644 --- a/pragma-deployer/pragma_deployer/gas_usage/compare_snapshot.py +++ b/pragma-deployer/pragma_deployer/gas_usage/compare_snapshot.py @@ -97,7 +97,7 @@ def get_previous_snapshot(): def get_current_gas_snapshot(): """Execute command and return current gas snapshots.""" - output = subprocess.check_output("scarb cairo-test", shell=True).decode("utf-8") + output = subprocess.check_output("cd pragma-oracle && scarb cairo-test", shell=True).decode("utf-8") pattern = r"test (.+?) \.\.\. ok \(gas usage est.: (\d+)\)" matches = re.findall(pattern, output) matches.sort() diff --git a/pragma-deployer/pragma_deployer/utils/constants.py b/pragma-deployer/pragma_deployer/utils/constants.py index 51862d00..c13ea3f7 100644 --- a/pragma-deployer/pragma_deployer/utils/constants.py +++ b/pragma-deployer/pragma_deployer/utils/constants.py @@ -68,16 +68,16 @@ CURRENT_FILE = Path(__file__).resolve() -REPO_ROOT = CURRENT_FILE.parent.parent.parent -PROJECT_ROOT = REPO_ROOT.parent / "pragma-oracle" +DEPLOYER_ROOT = CURRENT_FILE.parent.parent.parent +ORACLE_ROOT = DEPLOYER_ROOT.parent / "pragma-oracle" -BUILD_DIR = PROJECT_ROOT / "target" / "dev" +BUILD_DIR = ORACLE_ROOT / "target" / "dev" BUILD_DIR.mkdir(exist_ok=True, parents=True) -SOURCE_DIR = PROJECT_ROOT / "src" +SOURCE_DIR = ORACLE_ROOT / "src" CONTRACTS = {p.stem: p for p in list(SOURCE_DIR.glob("**/*.cairo"))} -DEPLOYMENTS_DIR = REPO_ROOT / "deployments" / NETWORK["name"] +DEPLOYMENTS_DIR = DEPLOYER_ROOT.parent / "deployments" / NETWORK["name"] DEPLOYMENTS_DIR.mkdir(exist_ok=True, parents=True) diff --git a/pragma-deployer/pragma_deployer/utils/starknet.py b/pragma-deployer/pragma_deployer/utils/starknet.py index 1805d50c..ff19b663 100644 --- a/pragma-deployer/pragma_deployer/utils/starknet.py +++ b/pragma-deployer/pragma_deployer/utils/starknet.py @@ -18,7 +18,7 @@ from pragma_deployer.utils.constants import ( BUILD_DIR, - POETRY_ROOT, + ORACLE_ROOT, # CONTRACTS, DEPLOYMENTS_DIR, ETH_TOKEN_ADDRESS, @@ -84,7 +84,7 @@ async def get_starknet_account(address=None, private_key=None, port=None) -> Acc async def get_eth_contract(port=None) -> Contract: - erc_20_path = POETRY_ROOT / "pragma_deployer" / "utils" / "erc20.json" + erc_20_path = ORACLE_ROOT / "pragma_deployer" / "utils" / "erc20.json" return Contract( ETH_TOKEN_ADDRESS, json.loads(erc_20_path.read_text())["abi"],