Skip to content
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

✨ Integration Tests #9

Merged
merged 27 commits into from
May 21, 2024
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
61 changes: 61 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: Rust

on:
push:
pull_request:

jobs:
integration_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# selecting a toolchain either by action or manual `rustup` calls should happen
# before the plugin, as the cache uses the current rustc version as its cache key
- run: rustup show

- uses: Swatinem/rust-cache@v2
- uses: software-mansion/setup-scarb@v1

- name: Build contracts
run: |
cd contracts && scarb build

- name: Build the rust code
run: |
cd rust && cargo build --release

- name: Install dojoup
run: |
curl -L https://install.dojoengine.org | bash

- name: Install dojo
run: |-
/home/runner/.config/.dojo/bin/dojoup -v 0.7.0-alpha.2
sudo mv /home/runner/.config/.dojo/bin/katana /usr/local/bin/

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Run katana
run: |
katana -b 1000 &

- name: Run evm -> strk test
run: |
cd rust && cargo test -- test_mailbox_evm_to_strk

- name: Kill katana
run: |
pkill katana

- name: run katana
run: |
katana -b 1000 &

- name: Run strk -> evm test
run: |
cd rust && cargo test -- test_mailbox_strk_to_evm


20 changes: 17 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
name: tests
name: contracts-tests
on:
push:
pull_request:

jobs:
check:
contracts:
runs-on: ubuntu-latest
env:
working-directory: ./contracts
steps:
- uses: actions/checkout@v3

- uses: software-mansion/setup-scarb@v1
- uses: foundry-rs/setup-snfoundry@v3

- working-directory: ${{ env.working-directory}}
run: scarb fmt --check

- name: Cache contracts
id: cache-contracts
uses: actions/cache@v3
with:
path: ./target
key: ${{ runner.os }}-contracts-${{ hashFiles('./src', 'Scarb.lock') }}

- working-directory: ${{ env.working-directory}}
run: scarb build
- working-directory: ${{ env.working-directory}}
run: snforge test
run: snforge test



6 changes: 6 additions & 0 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,10 @@ snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v
sort-module-level-items = true

[[target.starknet-contract]]
# Enable Sierra codegen.
sierra = true

# Enable CASM codegen.
casm = true
# Emit Python-powered hints in order to run compiled CASM class with legacy Cairo VM.
casm-add-pythonic-hints = false
5 changes: 5 additions & 0 deletions rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests/contracts/eth/bind/*.rs
!tests/contracts/eth/bind/mod.rs
tests/contracts/strk/bind/*.rs
!tests/contracts/strk/bind/mod.rs
target/
Loading
Loading