diff --git a/.github/workflows/protocol-tests.yaml b/.github/workflows/protocol-tests.yaml index 65e048e21..51eb403ac 100644 --- a/.github/workflows/protocol-tests.yaml +++ b/.github/workflows/protocol-tests.yaml @@ -5,8 +5,12 @@ on: paths: - 'protocol/**' +concurrency: + group: ${{github.workflow}}-${{github.ref}} + cancel-in-progress: true + jobs: - e2eTest: + hardhatTests: name: Hardhat Tests runs-on: ubuntu-latest steps: @@ -29,33 +33,103 @@ jobs: env: TESTS_MAINNET_RPC_URL: ${{ secrets.TESTS_MAINNET_RPC_URL }} - fuzzTest: + foundryTests: name: Foundry Tests - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + permissions: + # required for all workflows + security-events: write + # only required for workflows in private repositories + actions: read + contents: read + strategy: + matrix: + os: + - ubuntu-latest + node_version: + - 18 + steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v4 with: submodules: recursive - - uses: actions/setup-node@v3 + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v4 with: - node-version: '18.x' + node-version: ${{ matrix.node_version }} cache: 'yarn' cache-dependency-path: protocol/yarn.lock - - run: yarn install + - name: Install yarn project + run: yarn install working-directory: protocol - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: + version: nightly + # version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d cache: true - #with: - # version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d - - run: forge --version + - name: Show the Foundry CI config + run: forge config + env: + FOUNDRY_PROFILE: ci + + - name: Show the Foundry version + run: forge --version + working-directory: protocol + + - name: Foundry tests + run: forge test --gas-report working-directory: protocol + env: + FOUNDRY_PROFILE: ci + MAINNET_RPC_URL: ${{ secrets.TESTS_MAINNET_RPC_URL }} + + slither: + name: Slither + runs-on: ${{ matrix.os }} + permissions: + # only required for workflows in private repositories + actions: read + contents: read + strategy: + matrix: + os: + - ubuntu-latest + node_version: + - 18 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Use Node.js ${{ matrix.node_version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + cache: 'yarn' + cache-dependency-path: protocol/yarn.lock - - name: Run tests - run: FOUNDRY_PROFILE=ci forge test --gas-report + - name: Install yarn project + run: yarn install working-directory: protocol + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + version: nightly + # version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d + cache: false + + - name: install slither + run: cd protocol && pip install -r slither.requirements.txt + + # Can't output to SARIF for private repos without paying for Advanced Security + - name: run slither + run: cd protocol && yarn slither-check diff --git a/.github/workflows/slither.yaml b/.github/workflows/slither.yaml deleted file mode 100644 index be567ac3b..000000000 --- a/.github/workflows/slither.yaml +++ /dev/null @@ -1,52 +0,0 @@ -# We manually setup and run slither here, as the prebaked github action -# (at https://github.com/crytic/slither-action) -# fails with permission errors inside the docker container for this project - -name: Slither Analysis -on: - push: - paths: - - "protocol/**" - - ".github/workflows/slither.yaml" -jobs: - analyze: - # if: ${{ false }} # Slither has an issue with prb math, and is super slow... - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - cache: 'yarn' - cache-dependency-path: protocol/yarn.lock - - - run: yarn install - working-directory: protocol - - - name: Install Foundry - uses: foundry-rs/foundry-toolchain@v1 - with: - # Need to turn the cache off in slither so it can be used by - # protocol tests instead - # https://github.com/foundry-rs/foundry-toolchain/issues/33 - cache: false - #with: - # version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d - - - run: forge --version - working-directory: protocol - - - uses: actions/setup-python@v4 - with: - python-version: 3.9 - cache: 'pip' - cache-dependency-path: protocol/slither.requirements.txt - - - name: install slither - run: cd protocol && pip install -r slither.requirements.txt - - - name: run slither - run: cd protocol && yarn slither-check