Skip to content

Commit

Permalink
Merge pull request #26 from trillion-network/minor/remove-yarn-fix-lcov
Browse files Browse the repository at this point in the history
minor: remove yarn. fix lcov v2 changes. update to node LTS v22.11.0
  • Loading branch information
stanleygtrillion authored Nov 21, 2024
2 parents c75204e + e38a693 commit fc0e83d
Show file tree
Hide file tree
Showing 13 changed files with 368 additions and 529 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: coverage

on:
push:
branches: ["main"]
paths-ignore:
- README.md
pull_request:
branches: ["*"]
paths-ignore:
Expand Down Expand Up @@ -43,7 +39,7 @@ jobs:
# Filter out "script" contracts from coverage report
run: |
forge coverage --report lcov
lcov --remove ./lcov.info -o ./${{github.sha}}.lcov.info 'script'
lcov --remove ./lcov.info --rc derive_function_end_line=0 -o ./${{github.sha}}.lcov.info 'script'
id: coverage-base

- name: Archive base branch code coverage results
Expand All @@ -63,7 +59,7 @@ jobs:
# Filter out "script" contracts from coverage report
run: |
forge coverage --report lcov
lcov --remove ./lcov.info -o ./${{github.event.pull_request.base.sha}}.lcov.info 'script'
lcov --remove ./lcov.info --rc derive_function_end_line=0 -o ./${{github.event.pull_request.base.sha}}.lcov.info 'script'
id: coverage-head

- name: Archive head branch code coverage results
Expand All @@ -79,9 +75,9 @@ jobs:
name: ${{github.sha}}.lcov.info

- name: Code Coverage Report
uses: romeovs/lcov-reporter-action@87a815f34ec27a5826abba44ce09bbc688da58fd
# The reason for using a hash rather than a version/tag, is the project
# failed in publishing this release: https://github.com/romeovs/lcov-reporter-action/issues/47
# use trillion-network/lcov-reporter-action
# to get fix for https://github.com/romeovs/lcov-reporter-action/pull/61
uses: trillion-network/lcov-reporter-action@v0.4.0
with:
lcov-file: ./${{github.event.pull_request.base.sha}}.lcov.info
lcov-base: ./${{github.sha}}.lcov.info
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
node-version: 22
cache: "npm"
- name: Install dependencies
run: yarn install --immutable
run: npm ci
- name: Run solhint
run: yarn lint
run: npm run lint
10 changes: 5 additions & 5 deletions .github/workflows/publish_npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
node-version: 22
cache: "npm"
registry-url: "https://registry.npmjs.org"
scope: "@trillion-x"

# Publish ABIs to NPM
- name: Publish to NPM
run: |
yarn config set version-git-tag false
yarn version --new-version $(git describe --tags)
yarn publish
npm config set version-git-tag false
npm version --new-version $(git describe --tags)
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
node-version: 22
cache: "npm"
- name: Run Slither
uses: crytic/[email protected]
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ docs/

# Dotenv file
.env
.env.*

# Node modules
node_modules/
Expand All @@ -24,6 +25,7 @@ node_modules/
!.yarn/releases
!.yarn/plugins
.pnp.*
yarn.lock

# DS Store files
**/.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 20.5.0
nodejs 22.11.0
5 changes: 0 additions & 5 deletions .yarnrc.yml

This file was deleted.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Install missing dependencies that are shown in the install output (ex: `brew ins
foundryup
```

Install the Solidity linter (`solhint`) we use, as a yarn dependency:
Install the Solidity linter (`solhint`) we use, as a npm dependency:

```shell
yarn install
npm install
```

Install the Slither static analysis tool (used to find vulnerabilities):
Expand Down Expand Up @@ -82,12 +82,12 @@ You can generate a quick coverage summary by running:
forge coverage
```

However, you likely may want to filter out "`*.s.sol`" script contracts and render a nice web UI to examine code coverage, which you can do using the `yarn` script I've written:
However, you likely may want to filter out "`*.s.sol`" script contracts and render a nice web UI to examine code coverage, which you can do using the `npm` script I've written:

> NOTE: This requires having `lcov` installed locally through homebrew.
```shell
yarn coverage
npm run coverage
```

### Code Formatting
Expand All @@ -103,7 +103,7 @@ forge fmt
Solhint is a linter for our smart contracts. Run it like so:

```shell
yarn lint
npm run lint
```

### Static Analysis
Expand All @@ -128,7 +128,7 @@ forge snapshot

Any smart contracts that need to be used as dependencies (for example, OpenZeppelin) - should be installed using `forge install`. This will install them as a `git submodule`.

DO NOT use `yarn` to install smart contracts. The _only thing_ we use `yarn` for is to manage our Solidity linter `solhint`.
DO NOT use `npm` to install smart contracts. The _only thing_ we use `npm` for is to manage our Solidity linter `solhint`.

```shell
forge install
Expand Down
110 changes: 110 additions & 0 deletions broadcast/UpgradeFiatToken.s.sol/1/run-1730281244.json

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions broadcast/UpgradeFiatToken.s.sol/1/run-latest.json

Large diffs are not rendered by default.

122 changes: 122 additions & 0 deletions broadcast/UpgradeFiatToken.s.sol/10/run-latest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"lint": "solhint 'src/**/*.sol' && solhint --config .solhint.test.json 'test/**/*.t.sol'",
"test": "forge test",
"coverage": "forge coverage --report lcov && lcov --remove ./lcov.info -o ./lcov.info 'test/*' 'script/*' && genhtml lcov.info --branch-coverage --output-dir coverage && open coverage/index.html"
"coverage": "forge coverage --report lcov && lcov --remove ./lcov.info --rc derive_function_end_line=0 -o ./lcov.info 'test/*' 'script/*' && genhtml lcov.info --rc derive_function_end_line=0 --ignore-errors category --output-dir coverage && open coverage/index.html"
},
"devDependencies": {
"solhint": "^5.0.3"
Expand Down
Loading

0 comments on commit fc0e83d

Please sign in to comment.