Skip to content

Commit

Permalink
chore: merge PR #58 from sprtd/main
Browse files Browse the repository at this point in the history
doc: add local `RPC_URL` env variable in README
  • Loading branch information
sprtd authored Dec 24, 2024
2 parents fdbd07a + 7a290ba commit c1ef81f
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test_contracts.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test AutoSwap contracts
ame: Build and test AutoSwap contracts

on:
push:
Expand All @@ -7,7 +7,7 @@ on:
branches: ["main"]

env:
RPC_URL: ${{ secrets.RPC_URL }}
RPC_URL: ${{ vars.RPC_URL }}

jobs:
build:
Expand All @@ -26,7 +26,7 @@ jobs:

test:
runs-on: ubuntu-latest
# environment: autoswappr
environment: autoswappr
name: tests
steps:
- name: Checkout code
Expand All @@ -44,7 +44,7 @@ jobs:

- name: Substitute RPC URL in Scarb.toml
run: |
sed -i "s|\$RPC_URL|$RPC_URL|g" Scarb.toml
sed -i "s|\$RPC_URL|$RPC_URL|g" Scarb.toml
- name: Run tests
run: snforge test
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AutoSwappr is built on Starknet and implements:

## Prerequisites

To set up and run the project locally, ensure you have the following installed:
To set up and run the project locally, ensure you have [the following installed](https://foundry-rs.github.io/starknet-foundry/getting-started/installation.html#install-rust-version--1801):

- [**Starknet Foundry**](https://foundry-rs.github.io/starknet-foundry/index.html)
- [**Scarb**](https://docs.swmansion.com/scarb/download.html)
Expand Down Expand Up @@ -74,23 +74,40 @@ scarb build

## Testing

Run the test suite using Starknet Foundry:
Before running the tests,
1. Ensure the `RPC_URL` environment variable is set locally in your shell:
```bash
export RPC_URL=https://starknet-mainnet.public.blastapi.io/rpc/v0_7
```

2. Then save and reload your shell:
```bash
source ~/.zshrc
```

3. After setting the variable, verify it in your shell; this should output your rpc url in your terminal:
```bash
echo $RPC_URL
```

4. Proceed to run snforge test:
```bash
export RPC_URL=https://starknet-mainnet.public.blastapi.io/rpc/v0_7

snforge test
```


## Contributing

We welcome contributions! Please follow these steps:

1. Fork the repository
2. Create your feature branch (git checkout -b revoke-allowance)
3. Commit your changes (git commit -m 'test: revoke allowance')
4. Push to the branch (git push origin revoke-allowance)
5. Open a Pull Request
4. Run `bash test_local.sh` to ensure you have a consistent environment with our workflow actions; (Please make you have successfully set `RPC_URL` with this command - `export RPC_URL=https://starknet-mainnet.public.blastapi.io/rpc/v0_7`). All tests must pass locally before proceeding to the next action
5. Push to the branch (git push origin revoke-allowance)
6. Open a Pull Request



Expand Down
15 changes: 15 additions & 0 deletions test_local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Build the project
scarb build || exit 1

# Substitute RPC_URL
sed -i "s|\$RPC_URL|$RPC_URL|g" Scarb.toml

# Run tests
snforge test || exit 1

# Restore Scarb.toml
git checkout Scarb.toml

echo "Local test completed successfully!"

0 comments on commit c1ef81f

Please sign in to comment.