From d5522aa1b402798495ea9ff5d7f4f60785fa4442 Mon Sep 17 00:00:00 2001 From: andreivladbrg Date: Sat, 16 Dec 2023 01:02:58 +0200 Subject: [PATCH] build: install core as package and bump it to v1.1.1 build: remove git modules chore: update remappings and imports accordingly ci: cache the node_modules in build job to re-use it other jobs --- .github/workflows/ci-deep.yml | 16 ++++- .github/workflows/ci.yml | 98 +++++++----------------------- .gitmodules | 3 - lib/v2-core | 1 - package.json | 5 +- pnpm-lock.yaml | 11 ++-- remappings.txt | 3 +- test/Base.t.sol | 4 +- test/fork/Fork.t.sol | 4 +- test/integration/Integration.t.sol | 2 +- 10 files changed, 50 insertions(+), 97 deletions(-) delete mode 100644 .gitmodules delete mode 160000 lib/v2-core diff --git a/.github/workflows/ci-deep.yml b/.github/workflows/ci-deep.yml index 1084f4ed..f80fc622 100644 --- a/.github/workflows/ci-deep.yml +++ b/.github/workflows/ci-deep.yml @@ -53,12 +53,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: "Produce an optimized build with --via-ir" run: "FOUNDRY_PROFILE=optimized forge build" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ae71f75..ff568fe7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,8 +51,6 @@ jobs: steps: - name: "Check out the repo" uses: "actions/checkout@v3" - with: - submodules: "recursive" - name: "Install Foundry" uses: "foundry-rs/foundry-toolchain@v1" @@ -80,12 +78,13 @@ jobs: - name: "Build the test contracts" run: "FOUNDRY_PROFILE=test-optimized forge build" - - name: "Cache the build so that it can be re-used by the other jobs" + - name: "Cache the build and the node modules so that they can be re-used by the other jobs" uses: "actions/cache/save@v3" with: - key: "foundry-build-${{ github.sha }}" + key: "build-and-modules-${{ github.sha }}" path: | cache + node_modules out out-optimized @@ -106,33 +105,18 @@ 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: "Restore the cached build" + - name: "Restore the cached build and the node modules" uses: "actions/cache/restore@v3" with: fail-on-cache-miss: true - key: "foundry-build-${{ github.sha }}" + key: "build-and-modules-${{ github.sha }}" path: | cache + node_modules out out-optimized @@ -150,33 +134,18 @@ jobs: steps: - name: "Check out the repo" uses: "actions/checkout@v3" - with: - submodules: "recursive" - - - 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: "Install Foundry" uses: "foundry-rs/foundry-toolchain@v1" - - name: "Restore the cached build" + - name: "Restore the cached build and the node modules" uses: "actions/cache/restore@v3" with: fail-on-cache-miss: true - key: "foundry-build-${{ github.sha }}" + key: "build-and-modules-${{ github.sha }}" path: | cache + node_modules out out-optimized @@ -194,33 +163,15 @@ jobs: steps: - name: "Check out the repo" uses: "actions/checkout@v3" - with: - submodules: "recursive" - - 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: "Install Foundry" - uses: "foundry-rs/foundry-toolchain@v1" - - - name: "Restore the cached build" + - name: "Restore the cached build and the node modules" uses: "actions/cache/restore@v3" with: fail-on-cache-miss: true - key: "foundry-build-${{ github.sha }}" + key: "build-and-modules-${{ github.sha }}" path: | cache + node_modules out out-optimized @@ -241,23 +192,18 @@ jobs: runs-on: "ubuntu-latest" steps: - name: "Check out the repo" - uses: "actions/checkout@v3" - with: - submodules: "recursive" + uses: "actions/checkout@v3" - - name: "Install Pnpm" - uses: "pnpm/action-setup@v2" - with: - version: "8" - - - name: "Install Node.js" - uses: "actions/setup-node@v3" + - name: "Restore the cached build and the node modules" + uses: "actions/cache/restore@v3" with: - cache: "pnpm" - node-version: "lts/*" - - - name: "Install the Node.js dependencies" - run: "pnpm install" + fail-on-cache-miss: true + key: "build-and-modules-${{ github.sha }}" + path: | + cache + node_modules + out + out-optimized - name: "Install Foundry" uses: "foundry-rs/foundry-toolchain@v1" diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 06a8b026..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "lib/v2-core"] - path = "lib/v2-core" - url = "https://github.com/sablier-labs/v2-core" diff --git a/lib/v2-core b/lib/v2-core deleted file mode 160000 index 366c3331..00000000 --- a/lib/v2-core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 366c3331de7692c80bf952ce2391fdb80795b615 diff --git a/package.json b/package.json index af7a5b5b..704b23e4 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "dependencies": { "@openzeppelin/contracts": "4.9.2", "@prb/math": "4.0.2", - "@sablier/v2-core": "1.0.2" + "@sablier/v2-core": "1.1.1" }, "devDependencies": { "@prb/test": "0.6.4", @@ -24,6 +24,7 @@ "files": [ "artifacts", "src", + "test/utils", "CHANGELOG.md" ], "homepage": "https://github.com/sablier-labs/v2-periphery#readme", @@ -48,7 +49,7 @@ "web3" ], "peerDependencies": { - "@sablier/v2-core": "1.0.2" + "@sablier/v2-core": "1.1.1" }, "publishConfig": { "access": "public" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b591d8af..381481ab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ dependencies: specifier: 4.0.2 version: 4.0.2 '@sablier/v2-core': - specifier: 1.0.2 - version: 1.0.2(@openzeppelin/contracts@4.9.2)(@prb/math@4.0.2) + specifier: 1.1.1 + version: 1.1.1(@prb/math@4.0.2) devDependencies: '@prb/test': @@ -88,11 +88,10 @@ packages: resolution: {integrity: sha512-P0tTMsB6XQ0Wp61EYdXJYFhsOVGyZvcOFub2y9yk0sF+GYDusctR7DzEI+vOP0SILm3knFkEJASjewHEBppdRQ==} dev: true - /@sablier/v2-core@1.0.2(@openzeppelin/contracts@4.9.2)(@prb/math@4.0.2): - resolution: {integrity: sha512-BjobBTRLuh38fQsHtFGVsQI1XN9JXatldxbS+aFxlhYaU77fQimCejYrBqP7W1wQZnBAvdXRdKNPUskdUpM5nw==} + /@sablier/v2-core@1.1.1(@prb/math@4.0.2): + resolution: {integrity: sha512-gi9tYlNm5z29tfRwU/RM3Ljo/yvCpy4cmLosAYkhBTcdheZkqfkhZLgSKFv2OVq+0aKxH+YvzqGlt/ZtDhAeXg==} peerDependencies: - '@openzeppelin/contracts': 4.9.2 - '@prb/math': 4.0.1 + '@prb/math': 4.0.x dependencies: '@openzeppelin/contracts': 4.9.2 '@prb/math': 4.0.2 diff --git a/remappings.txt b/remappings.txt index ae446556..e5aca86c 100644 --- a/remappings.txt +++ b/remappings.txt @@ -1,7 +1,6 @@ @openzeppelin/contracts/=node_modules/@openzeppelin/contracts/ @prb/math/=node_modules/@prb/math/ @prb/test/=node_modules/@prb/test/ -@sablier/v2-core/=lib/v2-core/ -@sablier/v2-core-test/=lib/v2-core/test/ +@sablier/v2-core/=node_modules/@sablier/v2-core/ forge-std/=node_modules/forge-std/ solady/=node_modules/solady/ \ No newline at end of file diff --git a/test/Base.t.sol b/test/Base.t.sol index 8f08944d..16d0ed2d 100644 --- a/test/Base.t.sol +++ b/test/Base.t.sol @@ -10,8 +10,8 @@ import { ISablierV2LockupDynamic } from "@sablier/v2-core/src/interfaces/ISablie import { ISablierV2LockupLinear } from "@sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol"; import { LockupDynamic, LockupLinear } from "@sablier/v2-core/src/types/DataTypes.sol"; -import { Assertions as V2CoreAssertions } from "@sablier/v2-core-test/utils/Assertions.sol"; -import { Utils as V2CoreUtils } from "@sablier/v2-core-test/utils/Utils.sol"; +import { Assertions as V2CoreAssertions } from "@sablier/v2-core/test/utils/Assertions.sol"; +import { Utils as V2CoreUtils } from "@sablier/v2-core/test/utils/Utils.sol"; import { ISablierV2Batch } from "src/interfaces/ISablierV2Batch.sol"; import { ISablierV2MerkleStreamerFactory } from "src/interfaces/ISablierV2MerkleStreamerFactory.sol"; diff --git a/test/fork/Fork.t.sol b/test/fork/Fork.t.sol index 7d9dcced..f24afe72 100644 --- a/test/fork/Fork.t.sol +++ b/test/fork/Fork.t.sol @@ -4,9 +4,9 @@ pragma solidity >=0.8.19 <0.9.0; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; // import { ISablierV2LockupDynamic } from "@sablier/v2-core/src/interfaces/ISablierV2LockupDynamic.sol"; // import { ISablierV2LockupLinear } from "@sablier/v2-core/src/interfaces/ISablierV2LockupLinear.sol"; -import { Precompiles as V2CorePrecompiles } from "@sablier/v2-core-test/utils/Precompiles.sol"; +import { Precompiles as V2CorePrecompiles } from "@sablier/v2-core/test/utils/Precompiles.sol"; -import { Fuzzers as V2CoreFuzzers } from "@sablier/v2-core-test/utils/Fuzzers.sol"; +import { Fuzzers as V2CoreFuzzers } from "@sablier/v2-core/test/utils/Fuzzers.sol"; import { Defaults } from "../utils/Defaults.sol"; import { Base_Test } from "../Base.t.sol"; diff --git a/test/integration/Integration.t.sol b/test/integration/Integration.t.sol index 05c6a0bc..7d3c0728 100644 --- a/test/integration/Integration.t.sol +++ b/test/integration/Integration.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.19 <0.9.0; -import { Precompiles as V2CorePrecompiles } from "@sablier/v2-core-test/utils/Precompiles.sol"; +import { Precompiles as V2CorePrecompiles } from "@sablier/v2-core/test/utils/Precompiles.sol"; import { Defaults } from "../utils/Defaults.sol"; import { Base_Test } from "../Base.t.sol";