Skip to content

Commit

Permalink
yarn -> pnpm, remove husky/lint-staged. add github action for linting (
Browse files Browse the repository at this point in the history
…#101)

* Switched to pnpm to fix prettier issues

* Upgraded tasks to use pnpm

* fix pnpm setup

* fixed package.json tasks

* undo changes to package.json

* Caching pnpm install

* added lint github action.  intentionally breaking zora contract ot test it

* fix pnpm install

* remove husky

* fixed lint task

* fix prettier check command

* fix file
  • Loading branch information
oveddan authored Jun 5, 2023
1 parent 71495ca commit 563e0ff
Show file tree
Hide file tree
Showing 10 changed files with 2,233 additions and 2,079 deletions.
33 changes: 28 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,42 @@ jobs:
with:
submodules: recursive

- uses: actions/setup-node@v2
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

- run: npm install
node-version: 16

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge coverage
run: yarn run coverage
run: pnpm coverage
id: build

- name: Setup LCOV
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint
on: [pull_request]

jobs:
inspect-storage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.13.2"

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Run prettier
run: pnpm prettier:check
29 changes: 26 additions & 3 deletions .github/workflows/storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,39 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: "16.13.2"
- run: npm install

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: "Inspect Storage Layout"
continue-on-error: false
id: storage-inspect-check
run: |
forge build
yarn storage-inspect:check
pnpm storage-inspect:check
26 changes: 24 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,34 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/setup-node@v2
with:
node-version: "16"

- run: npm install
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
1 change: 0 additions & 1 deletion .husky/.gitignore

This file was deleted.

4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"plugins": ["prettier-plugin-solidity"],
"overrides": [
{
"files": "*.sol",
Expand Down
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"scripts": {
"test": "forge test",
"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' 'wagmi.config.ts'",
"coverage": "forge coverage --report lcov",
"write-gas-report": "forge test --gas-report > gasreport.ansi",
"prepack": "node script/copy-deployed-contracts.mjs && yarn run wagmi && yarn bundle-configs && yarn build-ts && yarn copy-addresses-and-configs",
"prepare": "husky install",
"prepack": "node script/copy-deployed-contracts.mjs && pnpm wagmi && pnpm bundle-configs && pnpm build-ts && pnpm copy-addresses-and-configs",
"build-ts": "tsup package/index.ts --format cjs --dts --sourcemap",
"bundle-configs": "node script/bundle-chainConfigs.mjs && yarn prettier",
"bundle-configs": "node script/bundle-chainConfigs.mjs && pnpm prettier:fix",
"copy-addresses-and-configs": "cp -r addresses/ dist/addresses && cp -r chainConfigs/ dist/chainConfigs",
"wagmi": "wagmi generate",
"storage-inspect:check": "./script/storage-check.sh check ZoraCreator1155Impl ZoraCreator1155FactoryImpl",
Expand All @@ -36,15 +36,11 @@
"@wagmi/cli": "^1.0.1",
"es-main": "^1.2.0",
"glob": "^10.2.2",
"husky": ">=6",
"lint-staged": "^13.2.2",
"listr2": "^6.4.2",
"prettier": "^2.8.8",
"prettier-plugin-solidity": "^1.1.1",
"prettier-plugin-solidity": "^1.1.3",
"tsup": "^6.7.0",
"typescript": "^5.0.4"
},
"lint-staged": {
"*.{sol,json}": "prettier --write"
}
"packageManager": "[email protected]"
}
Loading

0 comments on commit 563e0ff

Please sign in to comment.