From 748bc967f80cdd5c563315b6b65d6b005ead32f4 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Fri, 11 Aug 2023 16:09:26 -0400 Subject: [PATCH 1/9] feat: add maple as integration test --- crates/cli/tests/it/integration.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/cli/tests/it/integration.rs b/crates/cli/tests/it/integration.rs index be7b2d868bf7d..8c59c768b11f4 100644 --- a/crates/cli/tests/it/integration.rs +++ b/crates/cli/tests/it/integration.rs @@ -34,4 +34,5 @@ mod fork_integration { forgetest_external!(gunilev, "hexonaut/guni-lev", 13633752); forgetest_external!(convex, "mds1/convex-shutdown-simulation", 14445961); forgetest_external!(sparklend, "marsfoundation/sparklend"); + forgetest_external!(maple, "maple-labs/maple-core-v2"); } From 81eca4163056dce62efec28d842b6b4141dee973 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 17:17:59 -0400 Subject: [PATCH 2/9] feat: maple yml --- .github/workflows/maple.yml | 92 +++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 .github/workflows/maple.yml diff --git a/.github/workflows/maple.yml b/.github/workflows/maple.yml new file mode 100644 index 0000000000000..91cda194f5703 --- /dev/null +++ b/.github/workflows/maple.yml @@ -0,0 +1,92 @@ +name: Maple integration test + +on: + schedule: + # Runs at 10PM utc + - cron: "0 22 * * *" + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + build-tests: + name: build tests / ${{ matrix.archive.name }} + runs-on: ubuntu-latest + strategy: + matrix: + archive: + - name: maple-integration-test + file: maple-integration.tar.zst + flags: -p foundry-cli --features maple-integration-test + steps: + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - uses: taiki-e/install-action@nextest + - name: Build archive (maple tests) + run: | + cargo nextest archive \ + --locked \ + --archive-file ${{ matrix.archive.file }} \ + ${{ matrix.archive.flags }} + - name: Upload archive + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.archive.name }} + path: ${{ matrix.archive.file }} + + install-svm-solc: + name: install svm and solidity / ${{ matrix.job.name }} + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Install svm + run: cargo install svm-rs + - name: Install Solidity 0.8.19 + run: svm install 0.8.19 + - name: Install Solidity 0.8.20 + run: svm install 0.8.20 + - name: Use Solidity 0.8.19 + run: svm use 0.8.19 + + maple-integration: + name: maple integration tests / ${{ matrix.job.name }} + runs-on: ubuntu-latest + needs: build-tests + strategy: + matrix: + job: + - name: maple + filter: "!test(~live)" + env: + ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD + steps: + - uses: actions/checkout@v3 + - uses: taiki-e/install-action@nextest + - uses: dtolnay/rust-toolchain@stable + - name: Download archives + uses: actions/download-artifact@v3 + with: + name: maple-integration-test + + - name: Forge RPC cache + uses: actions/cache@v3 + if: matrix.job.name != 'non-forking' + with: + path: "$HOME/.foundry/cache" + key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }} + + - name: Setup git config + run: | + git config --global user.name "GitHub Actions Bot" + git config --global user.email "<>" + + - name: Force use of HTTPS for submodules + run: git config --global url."https://github.com/".insteadOf "git@github.com:" + + - name: cargo nextest + run: | + # see https://github.com/foundry-rs/foundry/pull/3959 + export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib" + cargo nextest run --retries 3 --archive-file maple-integration.tar.zst -E '${{ matrix.job.filter }}' \ No newline at end of file From e357dd159cb590b13079a7838903f777e5e10dac Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 17:18:20 -0400 Subject: [PATCH 3/9] chore: set up maple test independently --- crates/cli/Cargo.toml | 3 +++ crates/cli/tests/it/main.rs | 3 +++ crates/cli/tests/it/maple.rs | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 crates/cli/tests/it/maple.rs diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 21a72a38429ab..0e21aa99a2e0a 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -96,6 +96,9 @@ openssl = ["ethers/openssl"] # feature for integration tests that test external projects external-integration-tests = [] +# feature for maple integration test +maple-integration-test = [] + [[bin]] name = "cast" path = "src/cast/main.rs" diff --git a/crates/cli/tests/it/main.rs b/crates/cli/tests/it/main.rs index 18e79c26a5713..a790904d03e52 100644 --- a/crates/cli/tests/it/main.rs +++ b/crates/cli/tests/it/main.rs @@ -30,6 +30,9 @@ pub(crate) mod forge_utils; #[cfg(feature = "external-integration-tests")] mod integration; +#[cfg(feature = "maple-integration-test")] +mod maple; + pub mod constants; fn main() {} diff --git a/crates/cli/tests/it/maple.rs b/crates/cli/tests/it/maple.rs new file mode 100644 index 0000000000000..6ce8fbbd24297 --- /dev/null +++ b/crates/cli/tests/it/maple.rs @@ -0,0 +1,3 @@ +use foundry_cli_test_utils::forgetest_external; + +forgetest_external!(maple, "maple-labs/maple-core-v2"); \ No newline at end of file From c2fbaaf992f32a5729e8af25eb37c77f5c1034ab Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 17:19:16 -0400 Subject: [PATCH 4/9] chore: fmt --- crates/cli/tests/it/maple.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/cli/tests/it/maple.rs b/crates/cli/tests/it/maple.rs index 6ce8fbbd24297..6d5ffe15f37c4 100644 --- a/crates/cli/tests/it/maple.rs +++ b/crates/cli/tests/it/maple.rs @@ -1,3 +1,3 @@ use foundry_cli_test_utils::forgetest_external; -forgetest_external!(maple, "maple-labs/maple-core-v2"); \ No newline at end of file +forgetest_external!(maple, "maple-labs/maple-core-v2"); From 8e6d029164bccb0d7dd834e82d81723ce5e49a61 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 17:24:59 -0400 Subject: [PATCH 5/9] docs --- crates/cli/tests/it/maple.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/cli/tests/it/maple.rs b/crates/cli/tests/it/maple.rs index 6d5ffe15f37c4..58b11e0203070 100644 --- a/crates/cli/tests/it/maple.rs +++ b/crates/cli/tests/it/maple.rs @@ -1,3 +1,6 @@ use foundry_cli_test_utils::forgetest_external; +// Runs an integration test for maple. +// This is its own test because its extremely heavy, and as a result is not included +// in the normal run. forgetest_external!(maple, "maple-labs/maple-core-v2"); From b4c7dc10fe4895d0884a76de65859bf1ae8efaec Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 19:59:17 -0400 Subject: [PATCH 6/9] chore: rename maple to heavy integration tests --- crates/cli/Cargo.toml | 2 +- crates/cli/tests/it/heavy_integration.rs | 4 ++++ crates/cli/tests/it/main.rs | 4 ++-- crates/cli/tests/it/maple.rs | 6 ------ 4 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 crates/cli/tests/it/heavy_integration.rs delete mode 100644 crates/cli/tests/it/maple.rs diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 0e21aa99a2e0a..1c6777da1a26f 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -97,7 +97,7 @@ openssl = ["ethers/openssl"] external-integration-tests = [] # feature for maple integration test -maple-integration-test = [] +heavy-integration-tests = [] [[bin]] name = "cast" diff --git a/crates/cli/tests/it/heavy_integration.rs b/crates/cli/tests/it/heavy_integration.rs new file mode 100644 index 0000000000000..16db33965c153 --- /dev/null +++ b/crates/cli/tests/it/heavy_integration.rs @@ -0,0 +1,4 @@ +// ! Heavy integration tests that can take an hour to run or more. +use foundry_cli_test_utils::forgetest_external; + +forgetest_external!(maple, "maple-labs/maple-core-v2"); diff --git a/crates/cli/tests/it/main.rs b/crates/cli/tests/it/main.rs index a790904d03e52..e031bfb2c9dc5 100644 --- a/crates/cli/tests/it/main.rs +++ b/crates/cli/tests/it/main.rs @@ -30,8 +30,8 @@ pub(crate) mod forge_utils; #[cfg(feature = "external-integration-tests")] mod integration; -#[cfg(feature = "maple-integration-test")] -mod maple; +#[cfg(feature = "heavy-integration-tests")] +mod heavy_integration; pub mod constants; diff --git a/crates/cli/tests/it/maple.rs b/crates/cli/tests/it/maple.rs deleted file mode 100644 index 58b11e0203070..0000000000000 --- a/crates/cli/tests/it/maple.rs +++ /dev/null @@ -1,6 +0,0 @@ -use foundry_cli_test_utils::forgetest_external; - -// Runs an integration test for maple. -// This is its own test because its extremely heavy, and as a result is not included -// in the normal run. -forgetest_external!(maple, "maple-labs/maple-core-v2"); From fb6a87e074cf193483ab2dbd3727706f95045c1e Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 19:59:29 -0400 Subject: [PATCH 7/9] chore: more renaming --- .../{maple.yml => heavy-integration.yml} | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) rename .github/workflows/{maple.yml => heavy-integration.yml} (81%) diff --git a/.github/workflows/maple.yml b/.github/workflows/heavy-integration.yml similarity index 81% rename from .github/workflows/maple.yml rename to .github/workflows/heavy-integration.yml index 91cda194f5703..ec24c42cd8357 100644 --- a/.github/workflows/maple.yml +++ b/.github/workflows/heavy-integration.yml @@ -1,4 +1,4 @@ -name: Maple integration test +name: Heavy (long-running) integration tests on: schedule: @@ -16,15 +16,15 @@ jobs: strategy: matrix: archive: - - name: maple-integration-test - file: maple-integration.tar.zst - flags: -p foundry-cli --features maple-integration-test + - name: heavy-integration-tests + file: heavy-integration.tar.zst + flags: -p foundry-cli --features heavy-integration-tests steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - uses: taiki-e/install-action@nextest - - name: Build archive (maple tests) + - name: Build archive (long-running tests) run: | cargo nextest archive \ --locked \ @@ -50,14 +50,14 @@ jobs: - name: Use Solidity 0.8.19 run: svm use 0.8.19 - maple-integration: - name: maple integration tests / ${{ matrix.job.name }} + heavy-integration: + name: heavy (long-running) integration tests / ${{ matrix.job.name }} runs-on: ubuntu-latest needs: build-tests strategy: matrix: job: - - name: maple + - name: Long-running integration tests filter: "!test(~live)" env: ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD @@ -68,7 +68,7 @@ jobs: - name: Download archives uses: actions/download-artifact@v3 with: - name: maple-integration-test + name: heavy-integration-tests - name: Forge RPC cache uses: actions/cache@v3 @@ -89,4 +89,4 @@ jobs: run: | # see https://github.com/foundry-rs/foundry/pull/3959 export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib" - cargo nextest run --retries 3 --archive-file maple-integration.tar.zst -E '${{ matrix.job.filter }}' \ No newline at end of file + cargo nextest run --retries 3 --archive-file heavy-integration.tar.zst -E '${{ matrix.job.filter }}' \ No newline at end of file From 89d60120c9ca1d93267108d201ec803a608867a4 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 20:07:01 -0400 Subject: [PATCH 8/9] chore: create issue on failure --- .github/INTEGRATION_FAILURE.md | 10 ++++++++++ .github/workflows/heavy-integration.yml | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .github/INTEGRATION_FAILURE.md diff --git a/.github/INTEGRATION_FAILURE.md b/.github/INTEGRATION_FAILURE.md new file mode 100644 index 0000000000000..afa055b18364e --- /dev/null +++ b/.github/INTEGRATION_FAILURE.md @@ -0,0 +1,10 @@ +--- +title: "bug: long-running integration tests failed" +labels: P-high, T-bug +--- + +The heavy (long-running) integration tests have failed. This indicates a regression in foundry. + +Check the [heavy integration tests workflow page]({{env.WORKFLOW_URL}}) for details. + +This issue was raised by the workflow at `.github/workflows/heavy-integration.yml`. \ No newline at end of file diff --git a/.github/workflows/heavy-integration.yml b/.github/workflows/heavy-integration.yml index ec24c42cd8357..3a6e8df7873ed 100644 --- a/.github/workflows/heavy-integration.yml +++ b/.github/workflows/heavy-integration.yml @@ -89,4 +89,15 @@ jobs: run: | # see https://github.com/foundry-rs/foundry/pull/3959 export LD_LIBRARY_PATH="$(rustc --print sysroot)/lib" - cargo nextest run --retries 3 --archive-file heavy-integration.tar.zst -E '${{ matrix.job.filter }}' \ No newline at end of file + cargo nextest run --retries 3 --archive-file heavy-integration.tar.zst -E '${{ matrix.job.filter }}' + + # If any of the steps fail, this will create a high-priority issue + # to signal so. + - uses: JasonEtco/create-an-issue@v2 + if: ${{ failure() }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + with: + update_existing: true + filename: .github/INTEGRATION_FAILURE.md \ No newline at end of file From b4b61660faaac5cb39527545bf786f19d4672b32 Mon Sep 17 00:00:00 2001 From: Enrique Ortiz Date: Tue, 15 Aug 2023 20:14:01 -0400 Subject: [PATCH 9/9] chore: renaming & remove from integration --- crates/cli/Cargo.toml | 2 +- crates/cli/tests/it/integration.rs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 1c6777da1a26f..de75874a6692f 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -96,7 +96,7 @@ openssl = ["ethers/openssl"] # feature for integration tests that test external projects external-integration-tests = [] -# feature for maple integration test +# feature for heavy (long-running) integration tests heavy-integration-tests = [] [[bin]] diff --git a/crates/cli/tests/it/integration.rs b/crates/cli/tests/it/integration.rs index 8c59c768b11f4..be7b2d868bf7d 100644 --- a/crates/cli/tests/it/integration.rs +++ b/crates/cli/tests/it/integration.rs @@ -34,5 +34,4 @@ mod fork_integration { forgetest_external!(gunilev, "hexonaut/guni-lev", 13633752); forgetest_external!(convex, "mds1/convex-shutdown-simulation", 14445961); forgetest_external!(sparklend, "marsfoundation/sparklend"); - forgetest_external!(maple, "maple-labs/maple-core-v2"); }