-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(test): adding JS tests to the CI #284
Merged
Merged
Changes from 39 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
7a54233
ci: adding build to the ci along with sample js file
bd5ecfc
ci: changing the location of the bin
546c15b
ci: fixing again
2ff77fb
ci: fixing with location again
e6e0b19
ci: fixing ci with the path
bb2895f
ci: fixing try 5
63c1403
ci: fix 6
9076221
ci: fix 7
fb7f69c
ci: fix 8
59da248
ci: fix 9
c64ecb5
ci: fix 10
84f3d79
test: js test in working
2c4ff51
ci: updated for starknet js test
487cbf1
ci: looking for error in ci
65f6d19
ci: updating ci to make madara run in background
b4a7964
ci: adding tests directly where we run madara
cf66d68
ci: fixing the starknet js again
a559e43
ci: fixing 0
77ebc38
ci: fixing 1
b1f8045
ci: fixing 2
28911ff
ci: building cairo projects manually
3540f8f
ci: fixing again 4
7f282be
ci: trying to run tests atleast once
2818015
ci: fixing it again
5587604
ci: adding constand RPC_URL
bd82c3e
test: js test final cleanup
d48e9fa
test: ERC20 json removed
28ee4af
Delete js_tests/package-lock.json
Mohiiit 79bc557
Merge branch 'main' into test/js-test
Mohiiit a78f731
ci: cache key updated, account deploy test updated, docs added
8b94b87
Merge branch 'main' into test/js-test
Mohiiit 2374e7c
ci: trying triggering the ci
750f32a
ci: trying triggering the ci
1ad1310
linting
d982f44
ci: trying with different cache keys
f20630a
test: js_test moved under tests directory, changed workflow according…
fc1c4ab
test: updated the relative paths
8d936b9
linting
4e3b0f8
fix: trying syncing only 10 blocks for a test and restored the covera…
c649d6a
main merged
d6b3fd8
fix: fixing tests
2661e21
fix: fixing js test arguments and updating test a few blocks sync
d8eeafc
test: reduced devnet block time to 3 seconds
0e55b47
fix: fixing js tests by removing nonce
03dcf61
fix: js test fix:
a25dd48
Merge branch 'main' into test/js-test
Mohiiit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,42 @@ | ||
name: Task - Build Madara | ||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
jobs: | ||
build: | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
- uses: Swatinem/rust-cache@v2 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: 1.78.0 | ||
- name: Setup build deps | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y clang llvm libudev-dev protobuf-compiler | ||
- uses: rui314/setup-mold@v1 | ||
- uses: software-mansion/setup-scarb@v1 | ||
with: | ||
scarb-version: "2.8.2" | ||
- uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
- name: Build | ||
run: | | ||
cargo build --release --bin madara | ||
- name: Cache Madara binary | ||
uses: actions/cache@v3 | ||
with: | ||
path: target/release/madara | ||
key: ${{ runner.os }}-madara-${{ hashFiles('Cargo.lock') }} | ||
- name: Cache Cairo build artifacts | ||
uses: actions/cache@v3 | ||
with: | ||
path: cairo/target | ||
key: ${{ runner.os }}-madara-${{ hashFiles('Scarb.lock') }} |
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,32 @@ | ||
name: Starknet-js Compatibility Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
js-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Restore Madara binary | ||
uses: actions/cache@v3 | ||
with: | ||
path: target/release/madara | ||
key: ${{ runner.os }}-madara-${{ hashFiles('Cargo.lock') }} | ||
fail-on-cache-miss: true | ||
- name: Restore Cairo build artifacts | ||
uses: actions/cache@v3 | ||
with: | ||
path: cairo/target | ||
key: ${{ runner.os }}-madara-${{ hashFiles('Scarb.lock') }} | ||
fail-on-cache-miss: true | ||
- name: Setup dev chain and run tests | ||
run: | | ||
./target/release/madara --name madara --base-path ../madara3 --network devnet --authority --telemetry-disabled --rpc-port 9944 --rpc-cors "*" --rpc-external --devnet --preset test & | ||
MADARA_PID=$! | ||
while ! echo exit | nc localhost 9944; do sleep 1; done | ||
cd tests/js_tests | ||
npm install | ||
npm test | ||
kill $MADARA_PID |
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,25 @@ | ||
#[starknet::interface] | ||
pub trait IHelloStarknet<TContractState> { | ||
fn increase_balance(ref self: TContractState, amount: felt252); | ||
fn get_balance(self: @TContractState) -> felt252; | ||
} | ||
|
||
#[starknet::contract] | ||
mod HelloStarknet { | ||
#[storage] | ||
struct Storage { | ||
balance: felt252, | ||
} | ||
|
||
#[abi(embed_v0)] | ||
impl HelloStarknetImpl of super::IHelloStarknet<ContractState> { | ||
fn increase_balance(ref self: ContractState, amount: felt252) { | ||
assert(amount != 0, 'Amount cannot be 0'); | ||
self.balance.write(self.balance.read() + amount); | ||
} | ||
|
||
fn get_balance(self: @ContractState) -> felt252 { | ||
self.balance.read() | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,3 +3,4 @@ pub mod erc20; | |
pub mod udc; | ||
pub mod account; | ||
pub mod test_account; | ||
pub mod hello; |
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,3 @@ | ||
lib | ||
package-lock.json | ||
node_modules |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why you are calling 2 times software-mansion/setup-scarb@v1 for version 2.8.2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, removed