Skip to content

Commit

Permalink
made foundry reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
oveddan committed Oct 5, 2023
1 parent 63b0f7e commit c16cf9c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/foundry-1155-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "protocol-rewards"

on: push

jobs:
foundry-tasks:
uses: ./.github/workflows/foundry.yml
with:
package: "protocol-rewards"
9 changes: 9 additions & 0 deletions .github/workflows/foundry-protocol-rewards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: "1155-contracts"

on: push

jobs:
foundry-tasks:
uses: ./.github/workflows/foundry.yml
with:
package: "1155-contracts"
27 changes: 17 additions & 10 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Foundry
on:
workflow_call:
inputs:
package:
required: true
type: string

on: push
env:
# Setting an environment variable with the value of a configuration variable
package_folder: packages/${{ inputs.package }}

jobs:
build:
Expand All @@ -14,15 +21,15 @@ jobs:

- name: Build contracts
run: |
forge build
cd $package_folder && forge build
- name: Archive built artifacts
uses: actions/upload-artifact@v3
with:
name: foundry-built-artifacts
path: |
cache
out
${package_folder}/cache
${package_folder}/out
retention-days: 1

contract_size_check:
Expand All @@ -45,7 +52,7 @@ jobs:

- name: Check contract sizes
run: |
forge build --sizes
cd $package_folder && forge build --sizes
test:
needs: build
Expand All @@ -67,7 +74,7 @@ jobs:

- name: Run Forge tests
run: |
forge test -vvv
cd $package_folder && forge test -vvv
test_fork:
needs: build
Expand All @@ -89,7 +96,7 @@ jobs:

- name: Run fork tests
run: |
forge test -vvv --match-test fork
cd $package_folder && forge test -vvv --match-test fork
env:
FORK_TEST_CHAINS: mainnet,goerli,optimism,optimism_goerli,zora,zora_goerli,base_goerli,base
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
Expand All @@ -114,7 +121,7 @@ jobs:

- name: "Inspect Storage Layout"
continue-on-error: false
run: yarn run storage-inspect:check
run: cd $package_folder && yarn run storage-inspect:check

build_js:
needs: build
Expand All @@ -136,4 +143,4 @@ jobs:

- name: Build js package
run: |
yarn prepack
cd $package_folder && yarn prepack
1 change: 1 addition & 0 deletions packages/1155-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"prepack": "yarn wagmi && yarn bundle-configs && yarn build",
"update-new-deployment-addresses": "node script/copy-deployed-contracts.mjs deploy",
"update-contract-version": "node script/update-contract-version.mjs",
"build:contracts": "forge build",
"build": "tsup",
"bundle-configs": "node script/bundle-chainConfigs.mjs && yarn prettier",
"wagmi": "wagmi generate",
Expand Down

0 comments on commit c16cf9c

Please sign in to comment.