Skip to content

PI-15: Beanstalk Shipments #857

PI-15: Beanstalk Shipments

PI-15: Beanstalk Shipments #857

Workflow file for this run

name: Forge Tests
on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
env:
FORKING_RPC: ${{ secrets.ANVIL_FORK_URL }}
ARBITRUM_FORKING_RPC: ${{ secrets.ARBITRUM_FORKING_RPC }}
BASE_RPC: ${{ secrets.BASE_RPC }}
ETHEREUM_RPC: ${{ secrets.ETHEREUM_RPC }}
jobs:
check-sol-changes:
runs-on: ubuntu-latest
outputs:
sol-changed: ${{ steps.changes.outputs.sol-changed }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for Solidity file changes
id: changes
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
# For PRs, check changes against the base branch
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
else
# For pushes, check changes in the last commit
BASE_SHA="${{ github.event.before }}"
HEAD_SHA="${{ github.sha }}"
fi
echo "Checking for .sol file changes between $BASE_SHA and $HEAD_SHA"
if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -E '\.sol$'; then
echo "Solidity files changed"
echo "sol-changed=true" >> $GITHUB_OUTPUT
else
echo "No Solidity files changed"
echo "sol-changed=false" >> $GITHUB_OUTPUT
fi
forge-tests:
needs: check-sol-changes
if: needs.check-sol-changes.outputs.sol-changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: stable
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- name: Cache Node Modules
id: node-modules-cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Install Libraries
run: |
forge install
- name: Run Forge build
run: |
forge --version
forge clean
forge build --force
- name: Run Forge tests
run: forge test