Skip to content

Commit e733cc7

Browse files
committed
identify which tests to run
1 parent 3669e4f commit e733cc7

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

.github/workflows/ci-module.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ on:
1414
required: false
1515

1616
jobs:
17+
include:
18+
name: "include"
19+
runs-on: ubuntu-latest
20+
outputs:
21+
fork-tests: ${{ steps.include.outputs.fork }}
22+
integration-tests: ${{ steps.include.outputs.integration }}
23+
invariant-tests: ${{ steps.include.outputs.invariant }}
24+
unit-tests: ${{ steps.include.outputs.unit }}
25+
steps:
26+
- uses: actions/checkout@v4
27+
- id: include
28+
run: |
29+
echo "fork=$([ -d '${{ inputs.module }}/tests/fork' ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
30+
echo "integration=$([ -d '${{ inputs.module }}/tests/integration' ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
31+
echo "invariant=$([ -d '${{ inputs.module }}/tests/invariant' ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
32+
echo "unit=$([ -d '${{ inputs.module }}/tests/unit' ] && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
33+
1734
check:
1835
uses: "sablier-labs/gha-utils/.github/workflows/full-check.yml@main"
1936
with:
@@ -41,8 +58,8 @@ jobs:
4158
working-directory: ${{ inputs.module }}
4259

4360
test-fork:
44-
needs: ["build", "check"]
45-
if: needs.build.outputs.cache-status != 'primary'
61+
needs: ["build", "check", "include"]
62+
if: needs.build.outputs.cache-status != 'primary' && needs.include.outputs.fork-tests == 'true'
4663
secrets:
4764
ROUTEMESH_API_KEY: ${{ secrets.ROUTEMESH_API_KEY }}
4865
uses: "sablier-labs/gha-utils/.github/workflows/forge-test.yml@main"
@@ -52,15 +69,16 @@ jobs:
5269
${{ inputs.module }}/node_modules
5370
${{ inputs.module }}/out
5471
${{ inputs.module }}/out-optimized
72+
foundry-fuzz-runs: 20
5573
foundry-profile: "test-optimized"
5674
foundry-version: "v1.4.4"
5775
match-path: "tests/fork/**/*.sol"
5876
name: "test-fork"
5977
working-directory: ${{ inputs.module }}
6078

6179
test-integration:
62-
needs: ["build", "check"]
63-
if: needs.build.outputs.cache-status != 'primary'
80+
needs: ["build", "check", "include"]
81+
if: needs.build.outputs.cache-status != 'primary' && needs.include.outputs.integration-tests == 'true'
6482
uses: "sablier-labs/gha-utils/.github/workflows/forge-test.yml@main"
6583
with:
6684
cache-path: |
@@ -70,13 +88,13 @@ jobs:
7088
${{ inputs.module }}/out-optimized
7189
foundry-profile: "test-optimized"
7290
foundry-version: "v1.4.4"
73-
match-path: "tests/integration/**/*.sol"
91+
match-path: "tests/{integration,utils}/**/*.sol"
7492
name: "test-integration"
7593
working-directory: ${{ inputs.module }}
7694

7795
test-invariant:
78-
needs: ["build", "check"]
79-
if: needs.build.outputs.cache-status != 'primary'
96+
needs: ["build", "check", "include"]
97+
if: needs.build.outputs.cache-status != 'primary' && needs.include.outputs.invariant-tests == 'true'
8098
uses: "sablier-labs/gha-utils/.github/workflows/forge-test.yml@main"
8199
with:
82100
cache-path: |
@@ -91,8 +109,8 @@ jobs:
91109
working-directory: ${{ inputs.module }}
92110

93111
test-unit:
94-
needs: ["build", "check"]
95-
if: needs.build.outputs.cache-status != 'primary'
112+
needs: ["build", "check", "include"]
113+
if: needs.build.outputs.cache-status != 'primary' && needs.include.outputs.unit-tests == 'true'
96114
uses: "sablier-labs/gha-utils/.github/workflows/forge-test.yml@main"
97115
with:
98116
cache-path: |
@@ -107,8 +125,8 @@ jobs:
107125
working-directory: ${{ inputs.module }}
108126

109127
coverage:
110-
needs: ["build", "check", "test-integration"]
111-
if: needs.build.outputs.cache-status != 'primary'
128+
needs: ["build", "check", "include", "test-integration"]
129+
if: needs.build.outputs.cache-status != 'primary' && needs.include.outputs.integration-tests == 'true'
112130
secrets:
113131
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
114132
uses: "sablier-labs/gha-utils/.github/workflows/forge-coverage.yml@main"

airdrops/foundry.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
optimizer_runs = 100_000_000
88

99
[profile.default.fuzz]
10-
runs = 1000
10+
runs = 200
1111

1212
[profile.default.invariant]
1313
depth = 20

airdrops/tests/fork/Fork.t.sol

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ pragma solidity >=0.8.22 <0.9.0;
33

44
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
55
import { ISablierComptroller } from "@sablier/evm-utils/src/interfaces/ISablierComptroller.sol";
6-
import { ISablierFactoryMerkleInstant } from "src/interfaces/ISablierFactoryMerkleInstant.sol";
7-
import { ISablierFactoryMerkleLL } from "src/interfaces/ISablierFactoryMerkleLL.sol";
8-
import { ISablierFactoryMerkleLT } from "src/interfaces/ISablierFactoryMerkleLT.sol";
9-
import { ISablierFactoryMerkleVCA } from "src/interfaces/ISablierFactoryMerkleVCA.sol";
106
import { ISablierLockup } from "@sablier/lockup/src/interfaces/ISablierLockup.sol";
117

128
import { Base_Test } from "../Base.t.sol";
@@ -36,12 +32,9 @@ abstract contract Fork_Test is Base_Test {
3632
// Fork Ethereum Mainnet at the latest block number.
3733
vm.createSelectFork({ urlOrAlias: "ethereum" });
3834

39-
// Load deployed addresses from Ethereum Mainnet.
35+
// TODO: Load deployed addresses from Ethereum Mainnet.
4036
comptroller = ISablierComptroller(0x0000008ABbFf7a84a2fE09f9A9b74D3BC2072399);
41-
factoryMerkleInstant = ISablierFactoryMerkleInstant(0x7f70bA7C7373BaA4047cE450168cD24968321Bda);
42-
factoryMerkleLL = ISablierFactoryMerkleLL(0x0781Ad660a5ED0041B45d44d45009a163CC0B578);
43-
factoryMerkleLT = ISablierFactoryMerkleLT(0x336d464276e2c7C76927d975Ef866Df8a7Ecf8DD);
44-
factoryMerkleVCA = ISablierFactoryMerkleVCA(0x91FdBd7077d615f951a0defA81Ec30Bfd68dbd8D);
37+
deployFactoriesConditionally();
4538

4639
// Update lockup address.
4740
lockup = ISablierLockup(0xcF8ce57fa442ba50aCbC57147a62aD03873FfA73);

0 commit comments

Comments
 (0)