Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Abeeujah committed Dec 20, 2024
2 parents 1561c2c + c5fa623 commit f4daa91
Show file tree
Hide file tree
Showing 267 changed files with 3,459 additions and 813 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
needs: build-test-forge-e2e-nextest-archive
strategy:
matrix:
partition: [ 1, 2, 3, 4, 5, 6, 7, 8 ]
partition: [1, 2, 3, 4, 5, 6, 7, 8]
steps:
- name: Extract branch name
if: github.event_name != 'pull_request'
Expand Down Expand Up @@ -88,8 +88,8 @@ jobs:
- name: nextest partition ${{ matrix.partition }}/8
run: cargo nextest run --partition 'count:${{ matrix.partition }}/8' --archive-file 'nextest-archive.tar.zst' e2e

test-coverage:
name: Test coverage
test-scarb-2-8-3:
name: Test scarb 2.8.3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -105,6 +105,7 @@ jobs:
curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh
- run: cargo test --package forge --features scarb_2_8_3 --test main e2e::coverage
- run: cargo test --package forge --features scarb_2_8_3 --test main e2e::backtrace

test-coverage-error:
name: Test coverage error
Expand Down Expand Up @@ -141,6 +142,8 @@ jobs:
cargo test --package forge --features scarb_2_8_3 e2e::features
- run: |
cargo test --package scarb-api --features scarb_2_8_3 get_starknet_artifacts_path
- run: |
cargo test --package scarb-api --features scarb_2_8_3 test_load_contracts_artifacts
test-forge-runner:
name: Test Forge Runner
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
toolchain: stable
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install sitemap CLI
run: |
npm i -g static-sitemap-cli
- name: Install mdBook
run: |
cargo install --version ${MDBOOK_VERSION} mdbook
Expand Down Expand Up @@ -78,6 +82,10 @@ jobs:
curl -o highlight.js https://raw.githubusercontent.com/software-mansion/scarb/main/extensions/scarb-doc/theme/highlight.js
cp highlight.js ./docs/book/html/sncast_std/highlight.js
cp highlight.js ./docs/book/html/snforge_std/highlight.js
- name: Generate sitemap
run: |
sscli --base https://foundry-rs.github.io/starknet-foundry
working-directory: ./docs/book/html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/publish_plugin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish snforge_scarb_plugin

on:
workflow_call:
workflow_dispatch:

jobs:
upload-to-registry:
name: Upload plugin to the registry
runs-on: ubuntu-latest
env:
SCARB_REGISTRY_AUTH_TOKEN: ${{ secrets.SCARB_REGISTRY_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v4

- name: Check version
id: check-version
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
set -exo pipefail
snforge_scarb_plugin_version=$(grep version crates/snforge-scarb-plugin/Scarb.toml | cut -d '"' -f 2)
snforge_scarb_plugin_uploaded=$(curl -s https://scarbs.xyz/api/v1/index/sn/fo/snforge_scarb_plugin.json | jq --arg version "$snforge_scarb_plugin_version" '[.[] | select(.v == $version)] | length > 0')
echo "snforge_scarb_plugin_uploaded=$snforge_scarb_plugin_uploaded" >> $GITHUB_OUTPUT
- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a
with:
toolchain: stable

- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.5"

- name: Publish snforge_scarb_plugin
if: ${{ steps.check-version.outputs.snforge_scarb_plugin_uploaded == 'false' || github.event_name == 'workflow_dispatch' }}
working-directory: crates/snforge-scarb-plugin
run: scarb publish
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,35 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.create-release.outputs.computed-prefix }}${{ steps.create-release.outputs.version }}

publish-snforge-scarb-plugin:
name: Publish snforge_scarb_plugin
uses: ./.github/workflows/publish_plugin.yml
secrets: inherit

publish-to-registry:
name: Publish packages to the registry
runs-on: ubuntu-latest
needs: [ create-release, publish-snforge-scarb-plugin ]
env:
SCARB_REGISTRY_AUTH_TOKEN: ${{ secrets.SCARB_REGISTRY_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a
with:
toolchain: stable

- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.5"

- name: Publish sncast_std
working-directory: sncast_std
run: scarb publish --allow-dirty

- name: Publish snforge_std
working-directory: snforge_std
run: |
../scripts/set_plugin_version.sh
scarb publish --allow-dirty
125 changes: 125 additions & 0 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Scheduled

on:
pull_request:
paths:
- scripts/get_scarb_versions.sh
- .github/workflows/scheduled.yml
schedule:
- cron: '0 0 * * 3,0'

jobs:
get-scarb-versions:
name: Get Scarb versions
outputs:
versions: ${{ steps.get_versions.outputs.versions }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
with:
tool_versions: |
scarb latest
- name: Get versions
id: get_versions
run: |
scarb_versions=$(./scripts/get_scarb_versions.sh)
echo ${scarb_versions[@]}
echo "versions=[${scarb_versions[@]}]" >> "$GITHUB_OUTPUT"
test-forge-unit-and-integration:
runs-on: ubuntu-latest
needs: get-scarb-versions
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.get-scarb-versions.outputs.versions) }}

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ matrix.version }}
- uses: software-mansion/setup-universal-sierra-compiler@v1

- run: cargo test --release --lib -p forge
- run: cargo test --release -p forge integration

test-forge-e2e:
runs-on: ubuntu-latest
needs: get-scarb-versions
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.get-scarb-versions.outputs.versions) }}

steps:
- name: Extract branch name
if: github.event_name != 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV

- name: Extract branch name on pull request
if: github.event_name == 'pull_request'
run: echo "BRANCH_NAME=$(echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV

- name: Extract repo name and owner
if: github.event_name != 'pull_request'
run: echo "REPO_NAME=$(echo ${{ github.repository }}.git)" >> $GITHUB_ENV

- name: Extract repo name and owner on pull request
if: github.event_name == 'pull_request'
run: echo "REPO_NAME=$(echo ${{ github.event.pull_request.head.repo.full_name }}.git)" >> $GITHUB_ENV

- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ matrix.version }}
- uses: software-mansion/setup-universal-sierra-compiler@v1
- name: Install cairo-profiler
run: |
curl -L https://raw.githubusercontent.com/software-mansion/cairo-profiler/main/scripts/install.sh | sh
- uses: taiki-e/install-action@nextest

- run: cargo test --release -p forge e2e

test-cast:
runs-on: ubuntu-latest
needs: get-scarb-versions
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.get-scarb-versions.outputs.versions) }}

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: ${{ matrix.version }}
- uses: software-mansion/setup-universal-sierra-compiler@v1

- name: Install starknet-devnet-rs
run: ./scripts/install_devnet.sh

- run: cargo test --release -p sncast

notify_if_failed:
runs-on: ubuntu-latest
if: always() && contains(needs.*.result, 'failure') && github.event_name == 'schedule'
needs: [ test-forge-unit-and-integration, test-forge-e2e, test-cast ]
steps:
- name: Notify that the workflow has failed
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_SCHEDULED_TESTS_FAILURE_WEBHOOK_URL }}
with:
payload: |
{
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### `snforge_scarb_plugin`

#### Changed

- `snforge_scarb_plugin` will now also emit warnings when errors occur

## [0.34.0] - 2024-11-26

### Forge

#### Added

- `generate_random_felt()` for generating (pseudo) random felt value.
- Printing information about compiling Sierra using `universal-sierra-compiler`
- Displaying backtrace when contract call fails

#### Changed

Expand All @@ -24,10 +33,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- You can skip `--name` flag when using `account import` - a default name will be generated.
- Addresses outputted when calling `sncast account create`, `sncast deploy` and `sncast declare` are now padded to 64 characters length and prefixed with `0x0`
- Globally available configuration to store profiles to share between projects.

#### Changed

- Changed return type of `declare` in Cairo Deployment Scripts so it can handle already declared contracts without failing
- Allow using `show-config` command without providing rpc url

## [0.33.0] - 2024-11-04

Expand Down
Loading

0 comments on commit f4daa91

Please sign in to comment.