Skip to content

Add caching example #24

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from 3 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
38 changes: 35 additions & 3 deletions README.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd include an link to setup-scarb page as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: foundry-rs/setup-snfoundry@v3
- run: snforge
- uses: actions/checkout@v4
- name: Setup Starknet Foundry
uses: foundry-rs/setup-snfoundry@v3
- name: Check versions
run: |
snforge --version
sncast --version
```

## Inputs
Expand All @@ -35,4 +39,32 @@ jobs:
subdirectory (`${{ steps.setup-starknet-foundry.outputs.starknet-foundry-prefix }}/bin`).
- `starknet-foundry-version` - Version of Starknet Foundry that was installed (as reported by `snforge -V`).

## Caching

In order to optimalize the workflow, you should cache the Starknet Foundry installation. Here is an example of how to do it:

```yaml
name: My workflow
on:
push:
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Starknet Foundry
id: setup-snfoundry
uses: foundry-rs/setup-snfoundry@v3
- name: Check versions
run: |
snforge --version
sncast --version
- name: Cache Starknet Foundry installation
uses: actions/cache@v4
with:
path: ${{ steps.setup-snfoundry.outputs.starknet-foundry-prefix }}
key: ${{ runner.os }}-snfoundry-${{ steps.setup-snfoundry.outputs.starknet-foundry-version }}
```

[Starknet Foundry]: https://foundry-rs.github.io/starknet-foundry
Loading