Skip to content

Commit

Permalink
build: include test utils in package
Browse files Browse the repository at this point in the history
build: install prb test as npm package
build: install forge std as npm package
build: remove gitmodules
ci: install node js dependencies in build and test job
chore: update remappings accordingly
  • Loading branch information
andreivladbrg committed Nov 16, 2023
1 parent ce186b3 commit 977737d
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 39 deletions.
30 changes: 27 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,20 @@ jobs:
steps:
- 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:
submodules: "recursive"
cache: "pnpm"
node-version: "lts/*"

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

- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
Expand All @@ -68,12 +80,24 @@ jobs:
steps:
- name: "Check out the repo"
uses: "actions/checkout@v3"
with:
submodules: "recursive"

- 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 the Node.js dependencies"
run: "pnpm install"

- name: "Run the tests"
run: "forge test"

Expand Down
8 changes: 0 additions & 8 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion lib/forge-std
Submodule forge-std deleted from e8a047
1 change: 0 additions & 1 deletion lib/prb-test
Submodule prb-test deleted from 1e9ead
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
"url": "https://github.com/PaulRBerg/prb-math/issues"
},
"devDependencies": {
"@forge/std": "github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e",
"@prb/test": "0.6.4",
"prettier": "^2.8.7",
"solhint-community": "^3.5.2"
},
"files": [
"src",
"test/utils",
"CHANGELOG.md"
],
"homepage": "https://github.com/PaulRBerg/prb-math#readme",
Expand All @@ -30,6 +33,10 @@
"solidity"
],
"license": "MIT",
"peerDependencies": {
"@forge/std": "github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e",
"@prb/test": "0.6.4"
},
"publishConfig": {
"access": "public"
},
Expand All @@ -42,4 +49,4 @@
"prettier:check": "prettier --check \"**/*.{json,md,yml}\"",
"prettier:write": "prettier --write \"**/*.{json,md,yml}\""
}
}
}
18 changes: 17 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@prb/test/=lib/prb-test/src/
forge-std/=lib/forge-std/src/
@forge-std/=node_modules/@forge/std/
@prb/test/=node_modules/@prb/test/
6 changes: 0 additions & 6 deletions src/test/Assertions.sol

This file was deleted.

6 changes: 0 additions & 6 deletions src/test/Utils.sol

This file was deleted.

4 changes: 2 additions & 2 deletions test/Base.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { PRBTest } from "@prb/test/PRBTest.sol";
import { StdCheats } from "forge-std/StdCheats.sol";
import { PRBTest } from "@prb/test/src/PRBTest.sol";
import { StdCheats } from "@forge-std/src/StdCheats.sol";

import { PRBMathAssertions } from "./utils/Assertions.sol";
import { PRBMathUtils } from "./utils/Utils.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/sd59x18/SD59x18.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { console2 } from "forge-std/console2.sol";
import { console2 } from "@forge-std/src/console2.sol";

import { sd } from "src/sd59x18/Casting.sol";
import { ZERO } from "src/sd59x18/Constants.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/sd59x18/math/div/div.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { sd } from "src/sd59x18/Casting.sol";
import { MAX_SD59x18, MAX_WHOLE_SD59x18, MIN_SD59x18, MIN_WHOLE_SD59x18, PI, ZERO } from "src/sd59x18/Constants.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/sd59x18/math/inv/inv.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { MAX_SD59x18, MAX_WHOLE_SD59x18, MIN_SD59x18, MIN_WHOLE_SD59x18, PI, ZERO } from "src/sd59x18/Constants.sol";
import { inv } from "src/sd59x18/Math.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ud60x18/UD60x18.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { console2 } from "forge-std/console2.sol";
import { console2 } from "@forge-std/src/console2.sol";

import { ZERO } from "src/ud60x18/Constants.sol";
import { UD60x18 } from "src/ud60x18/ValueType.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ud60x18/math/div/div.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { MAX_UD60x18, MAX_WHOLE_UD60x18, PI, uUNIT, ZERO } from "src/ud60x18/Constants.sol";
import { div } from "src/ud60x18/Math.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ud60x18/math/inv/inv.t.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19 <0.9.0;

import { stdError } from "forge-std/StdError.sol";
import { stdError } from "@forge-std/src/StdError.sol";

import { MAX_UD60x18, MAX_WHOLE_UD60x18, PI, ZERO } from "src/ud60x18/Constants.sol";
import { inv } from "src/ud60x18/Math.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Assertions.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19;

import { PRBTest } from "@prb/test/PRBTest.sol";
import { PRBTest } from "@prb/test/src/PRBTest.sol";

import { SD1x18 } from "../../src/sd1x18/ValueType.sol";
import { SD59x18 } from "../../src/sd59x18/ValueType.sol";
Expand Down
2 changes: 1 addition & 1 deletion test/utils/Utils.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.19;

import { StdUtils } from "forge-std/StdUtils.sol";
import { StdUtils } from "@forge-std/src/StdUtils.sol";

import { SD1x18 } from "../../src/sd1x18/ValueType.sol";
import { SD59x18 } from "../../src/sd59x18/ValueType.sol";
Expand Down

0 comments on commit 977737d

Please sign in to comment.