Skip to content

Commit

Permalink
Merge pull request #184 from PaulRBerg/build/bun
Browse files Browse the repository at this point in the history
build: switch to bun for dep management
  • Loading branch information
PaulRBerg authored Dec 31, 2023
2 parents fcfaba0 + 0d6e313 commit fa13cf0
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 538 deletions.
18 changes: 5 additions & 13 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,14 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Lint the contracts"
run: "pnpm lint"
- name: "Lint the code"
run: "bun run lint"

- name: "Add lint summary"
run: |
Expand Down
74 changes: 17 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,14 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Lint the contracts"
run: "pnpm lint"
- name: "Lint the code"
run: "bun run lint"

- name: "Add lint summary"
run: |
Expand All @@ -56,19 +48,11 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Show the Foundry config"
run: "forge config"
Expand Down Expand Up @@ -112,19 +96,11 @@ jobs:
key: "foundry-build-${{ github.sha }}"
path: "out-optimized"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Run the tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test"
Expand All @@ -144,19 +120,11 @@ jobs:
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Run the tests and generate the coverage report"
run: "forge coverage --report lcov"
Expand All @@ -178,19 +146,11 @@ jobs:
- name: "Check out the repo"
uses: "actions/checkout@v3"

- name: "Install Pnpm"
uses: "pnpm/action-setup@v2"
with:
version: "8"

- name: "Install Node.js"
uses: "actions/setup-node@v3"
with:
cache: "pnpm"
node-version: "lts/*"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "bun install"

- name: "Run Slither"
uses: "crytic/[email protected]"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ out
.DS_Store
.pnp.*
lcov.info
package-lock.json
pnpm-lock.yaml
yarn.lock
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ out
*.log
.DS_Store
.pnp.*
bun.lockb
lcov.info
package-lock.json
pnpm-lock.yaml
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ You will need the following software on your machine:
- [Git](https://git-scm.com/downloads)
- [Foundry](https://github.com/foundry-rs/foundry)
- [Node.Js](https://nodejs.org/en/download/)
- [Pnpm](https://pnpm.io)
- [Bun](https://bun.sh)

In addition, familiarity with [Solidity](https://soliditylang.org/) is requisite.

Expand All @@ -25,7 +25,7 @@ $ git clone --recurse-submodules -j8 [email protected]:PaulRBerg/prb-proxy.git
Then, inside the project's directory, run this to install the Node.js dependencies:

```sh
$ pnpm install
$ bun install
```

Now you can start making changes.
Expand Down
Binary file added bun.lockb
Binary file not shown.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
"build": "forge build",
"build:optimized": "FOUNDRY_PROFILE=optimized forge build",
"clean": "rm -rf artifacts broadcast cache coverage docs out out-optimized",
"lint": "pnpm lint:sol && pnpm prettier:check",
"lint:sol": "forge fmt --check && pnpm solhint \"{script,src,test}/**/*.sol\"",
"lint": "bun run lint:sol && bun run prettier:check",
"lint:sol": "forge fmt --check && bun solhint \"{script,src,test}/**/*.sol\"",
"gas:report": "forge test --gas-report --no-match-test \"test(Fuzz)?_RevertWhen_\"",
"gas:snapshot": "forge snapshot --no-match-test \"test(Fuzz)?_RevertWhen_\"",
"prepack": "pnpm install && bash ./shell/prepare-artifacts.sh",
"gas:snapshot:optimized": "pnpm build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --no-match-test \"test(Fuzz)?_RevertWhen_\"",
"prepack": "bun install && bash ./shell/prepare-artifacts.sh",
"gas:snapshot:optimized": "bun run build:optimized && FOUNDRY_PROFILE=test-optimized forge snapshot --no-match-test \"test(Fuzz)?_RevertWhen_\"",
"prettier:check": "prettier --check \"**/*.{json,md,yml}\"",
"prettier:write": "prettier --write \"**/*.{json,md,yml}\""
}
Expand Down
Loading

0 comments on commit fa13cf0

Please sign in to comment.