Skip to content
This repository has been archived by the owner on Sep 5, 2023. It is now read-only.

Check for passing behavior tests #1055

Merged
merged 2 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 7 additions & 64 deletions .github/workflows/test-behaviour.yml
AlejandroLabourdette marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true

env:
CAIRO_LANG_VERSION: 0.10.3
CAIRO_LANG_VERSION: 0.11.0.2

jobs:
lint:
Expand Down Expand Up @@ -79,10 +79,7 @@ jobs:
- name: Running compilation tests
run: make test_compilation

build:
# only runs on pull requests to the main and develop branches
if: ${{ github.event_name == 'pull_request' && (github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'develop') }}

test-behaviour:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -111,63 +108,9 @@ jobs:

- name: Test code execution
run: |
yarn testnet:benchmark &
make test_execution

- name: Save benchmarks in artifacts
uses: actions/upload-artifact@v3
with:
name: benchmark
path: benchmark

benchmark:
if: ${{ github.event_name == 'push' }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2.2.2
with:
python-version: 3.9

- name: Setup env
run: |
pip install -r requirements.txt
pip install cairo-lang=="$CAIRO_LANG_VERSION"
pip install web3==5.*
pip install typeguard==2.*

- name: Setup source hash (push)
if: ${{ github.event_name == 'push' }}
run: |
echo "source_hash=${{ github.sha }}" >> $GITHUB_ENV

- name: Download Benchmarks
uses: actions/download-artifact@master
with:
name: benchmark
path: benchmark

- name: Create markdown file
run: |
mv benchmark/json/data.json benchmark/json/${{ env.source_hash }}.json
python ./starknet-testnet/generateMarkdown.py ${{ env.source_hash }}

- name: Push benchmarks to another repository
uses: dmnemec/copy_file_to_another_repo_action@main
starknet-devnet &
yarn test:behaviour
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_file: 'benchmark'
destination_repo: 'NethermindEth/warp-ts-benchmark'
commit_message: ${{ env.source_hash }}
destination_branch: main
user_email: 41898282+github-actions[bot]@users.noreply.github.com
user_name: 'Github Actions'

- name: Delete Artifact
uses: GeekyEggo/delete-artifact@v1.0.0
with:
name: benchmark
STARKNET_NETWORK: alpha-goerli
STARKNET_WALLET: starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount
STARKNET_ACCOUNT_DIR: $PWD/.starknet_accounts_devnet
9 changes: 4 additions & 5 deletions tests/behaviour/behaviour.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ interface AsyncTestCluster {
dependencies: Map<string, string[]>;
}

fs.writeFileSync(
path.join(BASE_PATH, '.starknet_accounts_devnet', 'starknet_open_zeppelin_accounts.json'),
'{}',
);
const accountDir = '.starknet_accounts_devnet';
fs.mkdirSync(accountDir, { recursive: true });
fs.writeFileSync(path.join(BASE_PATH, accountDir, 'starknet_open_zeppelin_accounts.json'), '{}');
const address = execSync(`${starknetCliCall('new_account', '')} | awk 'NR==1 {printf $3}'`);
console.log(`New address: ${address}`);
const addFunds = `curl ${DEVNET_URL}/mint -H "Content-Type: application/json" -d '{"address": "${address}", "amount": 1000000000000000000}'`;
Expand Down Expand Up @@ -170,7 +169,7 @@ describe('Compiled contracts are deployable', function () {
}
});

/*
/*
Test that the contracts that have been deployed have the correct output given a
corresponding input. These inputs are received from the test/expectations/index.ts
file which processes inputs and outputs from behaviour.ts and semantic.ts
Expand Down
Loading