From 687401f87a391c8203d75a261a27ba7639b92f92 Mon Sep 17 00:00:00 2001 From: Orlando Date: Thu, 29 Jun 2023 15:07:16 +0100 Subject: [PATCH] chore: Cairo and Solidity contracts CI --- .github/workflows/test.yml | 43 +++++++++++++++++++++++++++++++++++--- starknet/Scarb.toml | 4 ++-- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09880b1d..c2da946e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,16 +1,25 @@ name: test -on: workflow_dispatch +on: + push: + branches: + - develop + pull_request: env: FOUNDRY_PROFILE: ci + CAIRO_COMPILER_VERSION: v1.1.0 + ARCHIVE_LINK: https://github.com/starkware-libs/cairo/releases/download/v1.1.0/release-x86_64-unknown-linux-musl.tar.gz + ARCHIVE_NAME: cairo.zip + SCARB_INSTALLER: https://docs.swmansion.com/scarb/install.sh + SCARB_VERSION: 0.4.0 jobs: - check: + forge-tests: strategy: fail-fast: true - name: Foundry project + name: Forge tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -23,12 +32,40 @@ jobs: version: nightly - name: Run Forge build + working-directory: ./ethereum run: | forge --version forge build --sizes id: build - name: Run Forge tests + working-directory: ./ethereum run: | forge test -vvv id: test + + cairo-tests: + strategy: + fail-fast: true + + name: Cairo tests + runs-on: ubuntu-latest + steps: + - name: Step 1 - Check out main branch + uses: actions/checkout@v3 + - name: Step 2 - Downloading cairo binaries + run: curl -L -o $ARCHIVE_NAME $ARCHIVE_LINK + - name: Step 3 - Unzipping cairo binaries + run: tar -xvf $ARCHIVE_NAME + - name: Step 4 - Make cairo binaries available + run: echo "./cairo/bin" >> $GITHUB_PATH + - name: adding $HOME to path + run: echo "$HOME/.local/bin" >> $GITHUB_PATH + - name: Step 5 - Installing scarb + run: curl --proto '=https' --tlsv1.2 -sSf $SCARB_INSTALLER | sh -s -- -v $SCARB_VERSION + - name: Step 6 - Building Starknet contracts + working-directory: ./starknet + run: scarb build + - name: Step 7 - Running Starknet tests + working-directory: ./starknet + run: scarb cairo-test diff --git a/starknet/Scarb.toml b/starknet/Scarb.toml index 25eb52da..ef708f6f 100644 --- a/starknet/Scarb.toml +++ b/starknet/Scarb.toml @@ -5,10 +5,10 @@ version = "0.1.0" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest [[target.starknet-contract]] -# allowed-libfuncs-list.name = "experimental_v0.1.0" +allowed-libfuncs-list.name = "experimental_v0.1.0" [dependencies] -# starknet = ">=1.0.0" +starknet = ">=1.1.0" [scripts] run-lib = "cairo-run src/lib.cairo" \ No newline at end of file