-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improve CLI * Redo readme
- Loading branch information
Showing
7 changed files
with
72 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,43 @@ | ||
# Spark Spells GitHub Action | ||
# Spell Caster | ||
|
||
Execute a spell on a persisted, forked network with a shareable link. | ||
Execute a [Spark spell](https://github.com/marsfoundation/spark-spells) on a forked network with a shareable links. | ||
|
||
## Running | ||
Spell Caster can be run as CLI (for local testing) or configured as GitHub Action. | ||
|
||
## Running as CLI | ||
|
||
```bash | ||
bun install # only first time | ||
bun src/index.ts SparkEthereum_20240627 | ||
# fill out .env based on .env.example | ||
|
||
#bun src/index.ts --root <spark-spells-root-path> <spell-name> | ||
bun src/index.ts --root ../spark-spell SparkEthereum_20240627 | ||
``` | ||
|
||
## Running as Github Action | ||
|
||
Presents results as GitHub PR comment. | ||
|
||
```yml | ||
- name: Spell Caster | ||
uses: marsfoundation/spell-caster@action | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
TENDERLY_API_KEY: ${{ secrets.TENDERLY_ACCESS_KEY }} | ||
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }} | ||
TENDERLY_ACCOUNT: ${{ secrets.TENDERLY_USER }} | ||
``` | ||
## Developing | ||
```sh | ||
bun fix # to run linter, tests and typecheck | ||
``` | ||
``` | ||
|
||
### Bun support | ||
|
||
GitHub Runners don't support bun as runner environment so we use bun for testing and bundling but not as runtime dependency. | ||
|
||
### GH Action | ||
|
||
New release of github action (pushed to `action`) branch is done after each commit to `main` branch. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
import { $ } from 'dax-sh' | ||
import { Address } from 'viem' | ||
|
||
export async function deployContract(contractName: string, rpc: string, from: Address): Promise<Address> { | ||
const result = await $`forge create --rpc-url ${rpc} --from ${from} ${contractName} --unlocked --json`.json() | ||
export async function deployContract({ | ||
contractName, | ||
rpc, | ||
from, | ||
cwd, | ||
}: { contractName: string; rpc: string; from: Address; cwd: string }): Promise<Address> { | ||
const result = await $`forge create --rpc-url ${rpc} --from ${from} ${contractName} --unlocked --json`.cwd(cwd).json() | ||
return result.deployedTo | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as path from 'node:path' | ||
|
||
export function ensureAbsolutePath(p: string): string { | ||
return path.resolve(p) | ||
} |