From 76ce82b1f2c88729a858901a37606c6eec3c9404 Mon Sep 17 00:00:00 2001 From: Alex Metelli Date: Thu, 21 Dec 2023 14:09:17 +0800 Subject: [PATCH] added CI workflows for build + test (#17) LGTM! --- .github/workflows/build.yml | 23 +++++++++++++++++++ .github/workflows/test.yml | 23 +++++++++++++++++++ .gitignore | 2 ++ flex_marketplace/Scarb.lock | 2 +- flex_marketplace/Scarb.toml | 11 +++++---- flex_marketplace/src/lib.cairo | 2 +- .../src/marketplace/market_place.cairo | 4 ++-- 7 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..cbc15a1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: Build + +on: [push, pull_request] + +env: + SCARB_VERSION: 2.4.0 + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: software-mansion/setup-scarb@v1 + with: + scarb-version: ${{ env.SCARB_VERSION }} + - name: Check cairo format + run: | + cd flex_marketplace + scarb fmt --check + - name: Build cairo programs + run: | + cd flex_marketplace + scarb build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d0709c6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: Test + +on: [push, pull_request] + +env: + SCARB_VERSION: 2.4.0 + SNFORGE_VERSION: 0.13.0 + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: software-mansion/setup-scarb@v1 + with: + scarb-version: ${{ env.SCARB_VERSION }} + - uses: foundry-rs/setup-snfoundry@v2 + with: + starknet-foundry-version: ${{ env.SNFORGE_VERSION }} + - name: Run cairo tests + run: | + cd flex_marketplace + snforge test diff --git a/.gitignore b/.gitignore index 4ef41bd..479f519 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ flex_marketplace/target/ + +flex_marketplace/.snfoundry_cache/ diff --git a/flex_marketplace/Scarb.lock b/flex_marketplace/Scarb.lock index 40ddf27..6ae0a09 100644 --- a/flex_marketplace/Scarb.lock +++ b/flex_marketplace/Scarb.lock @@ -17,4 +17,4 @@ source = "git+https://github.com/openzeppelin/cairo-contracts?tag=v0.8.0#c23e8e9 [[package]] name = "snforge_std" version = "0.1.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.11.0#5465c41541c44a7804d16318fab45a2f0ccec9e7" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.13.0#99c2f9d33159988efd339bd969c78d82b0b4b6f7" diff --git a/flex_marketplace/Scarb.toml b/flex_marketplace/Scarb.toml index f01602a..842caad 100644 --- a/flex_marketplace/Scarb.toml +++ b/flex_marketplace/Scarb.toml @@ -1,9 +1,12 @@ [package] name = "flex" version = "0.1.0" - -# See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html +edition = "2023_01" [dependencies] -snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.11.0" } -openzeppelin = { git = "https://github.com/openzeppelin/cairo-contracts", tag = "v0.8.0" } \ No newline at end of file +starknet = "2.4.0" +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.13.0" } +openzeppelin = { git = "https://github.com/openzeppelin/cairo-contracts", tag = "v0.8.0" } + +[scripts] +test = "snforge test" \ No newline at end of file diff --git a/flex_marketplace/src/lib.cairo b/flex_marketplace/src/lib.cairo index 9e62e4c..e9812d0 100644 --- a/flex_marketplace/src/lib.cairo +++ b/flex_marketplace/src/lib.cairo @@ -1,7 +1,7 @@ mod marketplace { mod launchpad { mod ERC721_launchpad_migrated; - mod ERC721_Launchpad; + mod ERC721_launchpad; mod minter; } diff --git a/flex_marketplace/src/marketplace/market_place.cairo b/flex_marketplace/src/marketplace/market_place.cairo index ad46612..9fdd529 100644 --- a/flex_marketplace/src/marketplace/market_place.cairo +++ b/flex_marketplace/src/marketplace/market_place.cairo @@ -333,12 +333,12 @@ mod MarketPlace { fn calculate_protocol_fee( self: @ContractState, execution_strategy: felt252, amount: u128 ) -> u128 { // TODO - 0 + 0 } fn validate_order( self: @ContractState, order: MakerOrder, order_signature: Span - ) {// TODO + ) { // TODO } } }