diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6eb367d..57f6ba10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" @@ -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" diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 92e43181..00000000 --- a/.gitmodules +++ /dev/null @@ -1,8 +0,0 @@ -[submodule "lib/forge-std"] - branch = "v1" - path = "lib/forge-std" - url = "https://github.com/foundry-rs/forge-std" -[submodule "lib/prb-test"] - branch = "release-v0" - path = "lib/prb-test" - url = "https://github.com/PaulRBerg/prb-test" diff --git a/lib/forge-std b/lib/forge-std deleted file mode 160000 index e8a047e3..00000000 --- a/lib/forge-std +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e8a047e3f40f13fa37af6fe14e6e06283d9a060e diff --git a/lib/prb-test b/lib/prb-test deleted file mode 160000 index 1e9ead2f..00000000 --- a/lib/prb-test +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1e9ead2f7bfaedda3038081c16484b0d7d0b2712 diff --git a/package.json b/package.json index 19e0c29d..56b161b7 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,14 @@ "url": "https://github.com/PaulRBerg/prb-math/issues" }, "devDependencies": { + "@prb/test": "0.6.4", + "forge-std": "github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e", "prettier": "^2.8.7", "solhint-community": "^3.5.2" }, "files": [ "src", + "test/utils", "CHANGELOG.md" ], "homepage": "https://github.com/PaulRBerg/prb-math#readme", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7e2a7d7e..472db09c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,10 +1,16 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: true excludeLinksFromLockfile: false devDependencies: + '@prb/test': + specifier: 0.6.4 + version: 0.6.4 + forge-std: + specifier: github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e + version: github.com/foundry-rs/forge-std/e8a047e3f40f13fa37af6fe14e6e06283d9a060e prettier: specifier: ^2.8.7 version: 2.8.7 @@ -35,6 +41,10 @@ packages: js-tokens: 4.0.0 dev: true + /@prb/test@0.6.4: + resolution: {integrity: sha512-P0tTMsB6XQ0Wp61EYdXJYFhsOVGyZvcOFub2y9yk0sF+GYDusctR7DzEI+vOP0SILm3knFkEJASjewHEBppdRQ==} + dev: true + /@solidity-parser/parser@0.16.0: resolution: {integrity: sha512-ESipEcHyRHg4Np4SqBCfcXwyxxna1DgFVz69bgpLV8vzl/NP1DtcKsJ4dJZXWQhY/Z4J2LeKBiOkOVZn9ct33Q==} dependencies: @@ -442,3 +452,9 @@ packages: /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} dev: true + + github.com/foundry-rs/forge-std/e8a047e3f40f13fa37af6fe14e6e06283d9a060e: + resolution: {tarball: https://codeload.github.com/foundry-rs/forge-std/tar.gz/e8a047e3f40f13fa37af6fe14e6e06283d9a060e} + name: forge-std + version: 1.5.6 + dev: true diff --git a/remappings.txt b/remappings.txt index 853e434b..3cddfe74 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,2 +1,2 @@ -@prb/test/=lib/prb-test/src/ -forge-std/=lib/forge-std/src/ +@prb/test/=node_modules/@prb/test/ +forge-std/=node_modules/forge-std/ diff --git a/src/test/Assertions.sol b/src/test/Assertions.sol deleted file mode 100644 index 368dcd7c..00000000 --- a/src/test/Assertions.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.19; - -// solhint-disable no-unused-import -// This file is here for backward compatibility. It will be removed in V5. -import { PRBMathAssertions } from "../../test/utils/Assertions.sol"; diff --git a/src/test/Utils.sol b/src/test/Utils.sol deleted file mode 100644 index d950f435..00000000 --- a/src/test/Utils.sol +++ /dev/null @@ -1,6 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity >=0.8.19; - -// solhint-disable no-unused-import -// This file is here for backward compatibility. It will be removed in V5. -import { PRBMathUtils } from "../../test/utils/Utils.sol"; diff --git a/test/Base.t.sol b/test/Base.t.sol index 4515566c..6e25221d 100644 --- a/test/Base.t.sol +++ b/test/Base.t.sol @@ -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"; diff --git a/test/unit/sd59x18/SD59x18.t.sol b/test/unit/sd59x18/SD59x18.t.sol index 43a28b1d..5397e9a0 100644 --- a/test/unit/sd59x18/SD59x18.t.sol +++ b/test/unit/sd59x18/SD59x18.t.sol @@ -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"; diff --git a/test/unit/sd59x18/math/div/div.t.sol b/test/unit/sd59x18/math/div/div.t.sol index 869c3188..60ec8b41 100644 --- a/test/unit/sd59x18/math/div/div.t.sol +++ b/test/unit/sd59x18/math/div/div.t.sol @@ -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"; diff --git a/test/unit/sd59x18/math/inv/inv.t.sol b/test/unit/sd59x18/math/inv/inv.t.sol index 39d8e45c..4f66d7e2 100644 --- a/test/unit/sd59x18/math/inv/inv.t.sol +++ b/test/unit/sd59x18/math/inv/inv.t.sol @@ -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"; diff --git a/test/unit/ud60x18/UD60x18.t.sol b/test/unit/ud60x18/UD60x18.t.sol index e8f3ed07..ede9bfb2 100644 --- a/test/unit/ud60x18/UD60x18.t.sol +++ b/test/unit/ud60x18/UD60x18.t.sol @@ -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"; diff --git a/test/unit/ud60x18/math/div/div.t.sol b/test/unit/ud60x18/math/div/div.t.sol index e4dfdbdb..dc072987 100644 --- a/test/unit/ud60x18/math/div/div.t.sol +++ b/test/unit/ud60x18/math/div/div.t.sol @@ -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"; diff --git a/test/unit/ud60x18/math/inv/inv.t.sol b/test/unit/ud60x18/math/inv/inv.t.sol index 75e282a0..f7829802 100644 --- a/test/unit/ud60x18/math/inv/inv.t.sol +++ b/test/unit/ud60x18/math/inv/inv.t.sol @@ -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"; diff --git a/test/utils/Assertions.sol b/test/utils/Assertions.sol index 30deefbf..90e6354b 100644 --- a/test/utils/Assertions.sol +++ b/test/utils/Assertions.sol @@ -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"; diff --git a/test/utils/Utils.sol b/test/utils/Utils.sol index 0599c54b..0c1dbd77 100644 --- a/test/utils/Utils.sol +++ b/test/utils/Utils.sol @@ -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";