Skip to content

some refactor

some refactor #854

Workflow file for this run

# These tests are separated into a separate file to be able to use secrets when running in a fork.
# To avoid leaking secrets, we only allow contributors to run the tests.
# Note that pull_request_trigger runs from the base branch, not the head branch.
# So, we need to manually check out the head ref and merge the base branch into it.
name: integration
on:
push: # all
pull_request_target:
jobs:
integration:
name: "integration tests (Alchemy: fork mode and Sepolia)"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout (push)
uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
# given we use the pull_request_trigger, only allow contributors to run tests with secrets
- name: Check if the user is a contributor
uses: actions/github-script@v7
if: github.event_name == 'pull_request_target'
with:
script: |
const { actor: username, repo: { owner, repo } } = context;
const collaborator = await github.rest.repos.getCollaboratorPermissionLevel({ owner, repo, username });
if (!collaborator.data.user.permissions.push) {
core.setFailed(username + ' is not a contributor');
}
- name: Checkout ${{ github.event.pull_request.head.repo.full_name }}@${{ github.event.pull_request.head.sha }}
uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
fetch-depth: 0 # we need the history to be able to merge
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
cache: "pip"
- name: Install Requirements
run: |
pip install -r dev-requirements.txt
pip install .[forking-recommended]
- name: Run Fork Mode Tests
run: pytest -n auto tests/integration/fork/
env:
MAINNET_ENDPOINT: ${{ secrets.ALCHEMY_MAINNET_ENDPOINT }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
- name: Run Sepolia Tests
# disable xdist, otherwise they can contend for tx nonce
run: pytest -n 0 tests/integration/network/sepolia/
env:
SEPOLIA_ENDPOINT: ${{ secrets.ALCHEMY_SEPOLIA_ENDPOINT }}
SEPOLIA_PKEY: ${{ secrets.SEPOLIA_PKEY }}