diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac11a8eb1e8fb..6a2882467889f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,26 @@ jobs: unit: name: unit tests runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - uses: Swatinem/rust-cache@v1 + with: + cache-on-failure: true + + - name: cargo test + run: cargo test --locked --workspace --all-features --lib --bins --skip fork + + fork-unit: + name: fork unit tests + runs-on: ubuntu-latest env: ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD steps: @@ -29,32 +49,34 @@ jobs: uses: actions/cache@v3 with: path: "$HOME/.foundry/cache" - key: rpc-cache-${{ hashFiles('cli/tests/it/integration.rs') }} + key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }} - name: cargo test - run: cargo test --locked --workspace --all-features --lib --bins + run: cargo test --locked --workspace --all-features --lib --bins fork - doc: - name: doc tests + integration: + name: integration tests runs-on: ubuntu-latest steps: - name: Checkout sources uses: actions/checkout@v2 + - name: Install toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable profile: minimal override: true - - uses: Swatinem/rust-cache@v1 + - name: Rust cache + uses: Swatinem/rust-cache@v1 with: cache-on-failure: true - name: cargo test - run: cargo test --locked --workspace --all-features --doc + run: cargo test --locked --workspace -- --skip fork - integration: - name: integration tests + fork-integration: + name: fork integration tests runs-on: ubuntu-latest steps: - name: Checkout sources @@ -74,14 +96,37 @@ jobs: uses: actions/cache@v3 with: path: "$HOME/.foundry/cache" - key: rpc-cache-${{ hashFiles('cli/tests/it/integration.rs') }} + key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }} - name: cargo test - run: cargo test --locked --workspace --test '*' + run: cargo test --locked --workspace -- fork external-integration: name: external integration tests runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - uses: Swatinem/rust-cache@v1 + with: + cache-on-failure: true + + - name: Force use of HTTPS for submodules + run: git config --global url."https://github.com/".insteadOf "git@github.com:" + + - name: cargo test + run: cargo test --locked -p foundry-cli --features external-integration-tests -- --skip fork + + external-fork-integration: + name: external fork integration tests + runs-on: ubuntu-latest env: ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD steps: @@ -101,13 +146,32 @@ jobs: uses: actions/cache@v3 with: path: "$HOME/.foundry/cache" - key: rpc-cache-${{ hashFiles('cli/tests/it/integration.rs') }} + key: rpc-cache-${{ hashFiles('cli/tests/rpc-cache-keyfile') }} - name: Force use of HTTPS for submodules run: git config --global url."https://github.com/".insteadOf "git@github.com:" - name: cargo test - run: cargo test --locked --workspace --features external-integration-tests --test '*' + run: cargo test --locked -p foundry-cli --features external-integration-tests fork_integration + + doc: + name: doc tests + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - uses: Swatinem/rust-cache@v1 + with: + cache-on-failure: true + + - name: cargo test + run: cargo test --locked --workspace --all-features --doc lint: runs-on: ubuntu-latest diff --git a/cli/tests/it/integration.rs b/cli/tests/it/integration.rs index 495792ff9aa65..ae14492b38ff1 100644 --- a/cli/tests/it/integration.rs +++ b/cli/tests/it/integration.rs @@ -4,12 +4,16 @@ forgetest_external!(solmate, "Rari-Capital/solmate"); forgetest_external!(geb, "reflexer-labs/geb", &["--chain-id", "99"]); forgetest_external!(stringutils, "Arachnid/solidity-stringutils"); // forgetest_external!(vaults, "Rari-Capital/vaults"); -forgetest_external!(multicall, "makerdao/multicall", &["--block-number", "1"]); forgetest_external!(lootloose, "gakonst/lootloose"); forgetest_external!(lil_web3, "m1guelpf/lil-web3"); forgetest_external!(maple_loan, "maple-labs/loan"); -// Forking tests -forgetest_external!(drai, "mds1/drai", 13633752, &["--chain-id", "99"]); -forgetest_external!(gunilev, "hexonaut/guni-lev", 13633752); -forgetest_external!(convex, "mds1/convex-shutdown-simulation", 14445961); +/// Forking tests +mod fork_integration { + use foundry_cli_test_utils::forgetest_external; + + forgetest_external!(multicall, "makerdao/multicall", &["--block-number", "1"]); + forgetest_external!(drai, "mds1/drai", 13633752, &["--chain-id", "99"]); + forgetest_external!(gunilev, "hexonaut/guni-lev", 13633752); + forgetest_external!(convex, "mds1/convex-shutdown-simulation", 14445961); +} diff --git a/cli/tests/rpc-cache-keyfile b/cli/tests/rpc-cache-keyfile new file mode 100644 index 0000000000000..211412923ecb5 --- /dev/null +++ b/cli/tests/rpc-cache-keyfile @@ -0,0 +1,5 @@ +This file serves as the key for the github actions/cache + +Any change in this file will invalidate the cache in CI that stores RPC data. + +Last updated: 05-26-2022 \ No newline at end of file