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 new file mode 100644 index 0000000000000..3a6e8df7873ed --- /dev/null +++ b/.github/workflows/heavy-integration.yml @@ -0,0 +1,103 @@ +name: Heavy (long-running) integration tests + +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: 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 (long-running 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 + + heavy-integration: + name: heavy (long-running) integration tests / ${{ matrix.job.name }} + runs-on: ubuntu-latest + needs: build-tests + strategy: + matrix: + job: + - name: Long-running integration tests + 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: heavy-integration-tests + + - 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 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 diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 21a72a38429ab..de75874a6692f 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 heavy (long-running) integration tests +heavy-integration-tests = [] + [[bin]] name = "cast" path = "src/cast/main.rs" 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 18e79c26a5713..e031bfb2c9dc5 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 = "heavy-integration-tests")] +mod heavy_integration; + pub mod constants; fn main() {}