Skip to content
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

Monorepo - condensed workflow tasks #247

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 2 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ jobs:

- name: Setup LCOV
uses: hrishikesh-kadam/setup-lcov@v1
with:
working-directory: ./$package_folder

- name: Filter files to ignore
run: |
cd $package_folder && lcov --rc lcov_branch_coverage=1 \
cd ./${{ env.package_folder }} && lcov --rc lcov_branch_coverage=1 \
--remove lcov.info \
--output-file lcov.info "*node_modules*" "*test*" "*script*" "*DeploymentConfig*" "*Redeem*" "*deployment*"

Expand All @@ -46,4 +44,4 @@ jobs:
minimum-coverage: 89
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./$package_folder
working-directory: ./${{ env.package_folder }}
45 changes: 23 additions & 22 deletions .github/workflows/foundry-base.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
on:
workflow_call:
inputs:
package:
required: true
type: string
name: "Foundry"

on: "push"

env:
# Setting an environment variable with the value of a configuration variable
package_folder: packages/${{ inputs.package }}
build_artifact: foundry-built-artifacts-${{ inputs.package }}
$build_artifact: foundry_artifact

jobs:
build:
Expand All @@ -22,22 +18,17 @@ jobs:

- name: Build contracts
run: |
cd $package_folder && forge build
npx turbo run build:contracts

- name: Archive built artifacts
uses: actions/upload-artifact@v3
with:
name: $build_artifact
path: |
packages/${{ inputs.package }}/cache
packages/${{ inputs.package }}/out
**/*/cache
**/*/out
retention-days: 1

coverage:
uses: ./.github/workflows/coverage.yml
with:
package: ${{ inputs.package }}

contract_size_check:
needs: build
strategy:
Expand All @@ -58,7 +49,7 @@ jobs:

- name: Check contract sizes
run: |
cd $package_folder && forge build --sizes
npx turbo run check-contract-size

test:
needs: build
Expand All @@ -78,9 +69,9 @@ jobs:
with:
name: $build_artifact

- name: Run Forge tests
- name: Run tests
run: |
cd $package_folder && forge test -vvv
npx turbo run test

test_fork:
needs: build
Expand All @@ -102,7 +93,7 @@ jobs:

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

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

build_js:
needs: build
Expand All @@ -149,4 +140,14 @@ jobs:

- name: Build js package
run: |
cd $package_folder && yarn prepack
npx turbo run prepack

coverage-1155:
uses: ./.github/workflows/coverage.yml
with:
package: "1155-contracts"

coverage-protocol-rewards:
uses: ./.github/workflows/coverage.yml
with:
package: "protocol-rewards"
21 changes: 12 additions & 9 deletions .github/workflows/foundry-by-package.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
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:
# we need to prepend _ to conform to 1155 standards
_1155:
uses: ./.github/workflows/foundry-base.yml
coverage:
uses: ./.github/workflows/coverage.yml
with:
package: "1155-contracts"
protocol-rewards:
uses: ./.github/workflows/foundry-base.yml
with:
package: "protocol-rewards"
package: ${{ inputs.package }}
2 changes: 2 additions & 0 deletions packages/1155-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"type": "module",
"scripts": {
"test": "forge test",
"test:fork": "forge test -vvv --match-test fork",
"test-gas": "forge test --gas-report",
"prettier:check": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'package/**/*.ts' 'wagmi.config.ts'",
"prettier": "prettier --write 'src/**/*.sol' 'test/**/*.sol' 'package/**/*.ts' 'script/**/*.ts' 'wagmi.config.ts'",
Expand All @@ -20,6 +21,7 @@
"update-contract-version": "node script/update-contract-version.mjs",
"build:contracts": "forge build",
"build": "tsup",
"build:sizes": "forge build --sizes",
"bundle-configs": "node script/bundle-chainConfigs.mjs && yarn prettier",
"wagmi": "wagmi generate",
"publish-packages": "yarn prepack && changeset publish",
Expand Down
2 changes: 2 additions & 0 deletions packages/protocol-rewards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
],
"scripts": {
"build": "forge build",
"build:sizes": "forge build --sizes",
"test": "forge test",
"build:contracts": "forge build",
"prettier:check": "prettier --check 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'",
"prettier": "prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'",
"lint": "yarn run prettier"
Expand Down
16 changes: 16 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,25 @@
"dependsOn": ["^build"],
"outputs": [".dist/**"]
},
"build:contracts": {
"dependsOn": ["^build:contracts"],
"outputs": [".dist/**"]
},
"check-contract-size": {
"dependsOn": ["^build:sizes"]
},
"test": {
"dependsOn": ["^test"]
},
"test:fork": {
"dependsOn": ["^test:fork"]
},
"storage-inspect:check": {
"dependsOn": ["^storage-inspect:check"]
},
"prepack": {
"dependsOn": ["^prepack"]
},
"lint": {
"dependsOn": ["^lint"]
},
Expand Down
Loading