feat: Test integration gmx #2996
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Automated test suite | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| test-python: | |
| # Reserved multicore instance for running tests | |
| runs-on: | |
| group: Beefy runners | |
| # Only run the action for the latest push | |
| # See https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.python-version }}-${{ matrix.web3-version }} | |
| cancel-in-progress: true | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # for now let's keep the 3.13 aside as many of the modules don't support it yet | |
| # The project is developed using 3.12. 3.10 has some encoding issues which is causing some tests to fail | |
| python-version: ["3.12"] | |
| # v6 has it's own separate workflow | |
| web3-version: ["7"] | |
| name: Python ${{ matrix.python-version }} - Web3.py v${{ matrix.web3-version }} | |
| steps: | |
| # TODO: we only need contracts/aave-v3-deploy for tests | |
| # but there does not seem to be an option to choose which submodules to checkout | |
| # https://github.com/actions/checkout | |
| - uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| # npm version need to support aave-deploy | |
| node-version: 18 | |
| cache: "npm" | |
| cache-dependency-path: contracts/aave-v3-deploy/package-lock.json | |
| # pnpm needed to compile Enzyme | |
| # We need version 7 to be exact. | |
| - name: Install pnpm | |
| run: | | |
| curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=7.27.1 sh - | |
| PNPM_HOME="/home/runner/.local/share/pnpm" | |
| # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path | |
| echo $PNPM_HOME >> $GITHUB_PATH | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Disable cache to force fresh installation when debugging | |
| # cache: "poetry" | |
| # Poetry 2.0 breaks everything | |
| # https://github.com/python-poetry/poetry/blob/main/CHANGELOG.md | |
| - name: Install poetry (using matrix Python) | |
| run: pipx install "poetry>2" --python "${{ env.PYTHON_PATH }}" | |
| # Install dependencies with the specific Web3.py version | |
| # Using a single installation command to avoid conflicts | |
| - name: Install dependencies with specific Web3.py version | |
| run: | | |
| poetry install | |
| poetry install -E docs -E data -E test -E hypersync -E web3v7 | |
| - name: Install Ganache | |
| run: yarn global add ganache | |
| - name: Install Foundry | |
| uses: foundry-rs/foundry-toolchain@v1 | |
| with: | |
| # pick a nightly release from: https://github.com/foundry-rs/foundry/releases | |
| # version: "nightly-de33b6af53005037b463318d2628b5cfcaf39916" | |
| #version: "nightly-fdd321bac95f0935529164a88faf99d4d5cfa321" | |
| version: "v1.2.3" | |
| # We also work around race condition for setting up Aave NPM packages. | |
| - name: Setup Aave v3 for tests | |
| run: | | |
| poetry run install-aave-for-testing | |
| # We also work around race condition for setting up Aave NPM packages. | |
| - name: Build needed contracts | |
| run: | | |
| pnpm --version | |
| # Broken with the latest foudry? | |
| # make guard in-house safe-integration | |
| # Lagoon source deployment needs soldeer | |
| - name: Lagoon dependency issue smoke test | |
| run: | | |
| export PATH="$HOME/.cargo/bin:$PATH" | |
| (cd contracts/lagoon-v0 && forge soldeer install) | |
| ls -lha contracts/lagoon-v0/dependencies/ | |
| ls -lha contracts/lagoon-v0/dependencies/@openzeppelin-contracts-upgradeable-5.0.0/ | |
| # CRITICAL: Verify the correct Web3.py version is installed | |
| # This helps debug any remaining issues | |
| - name: Verify Web3.py version and environment isolation | |
| run: | | |
| echo "=== Environment Information ===" | |
| poetry env info | |
| echo "" | |
| echo "=== Python Version ===" | |
| poetry run python --version | |
| echo "" | |
| echo "=== Web3.py Version ===" | |
| poetry run python -c "import web3; print(f'Web3.py version: {web3.__version__}')" | |
| echo "" | |
| echo "=== Installed Packages (Web3-related) ===" | |
| poetry run python -c " | |
| import pkg_resources | |
| web3_packages = [pkg for pkg in pkg_resources.working_set if 'web3' in pkg.project_name.lower() or 'eth' in pkg.project_name.lower()] | |
| for pkg in sorted(web3_packages, key=lambda x: x.project_name): | |
| print(f'{pkg.project_name}: {pkg.version}') | |
| " | |
| # Setup Debug Session before tests - Enable this when you need to debug test issues | |
| # - name: Setup Debug Session Before Tests | |
| # uses: csexton/debugger-action@master | |
| # - name: Setup tmate session for debugging | |
| # uses: mxschmitt/action-tmate@v3 | |
| # with: | |
| # limit-access-to-actor: true | |
| # if: ${{ failure() || github.event.inputs.debug == 'true' }} | |
| - name: Run tests (parallel) | |
| run: | | |
| # Enable verbose output if debugging is enabled | |
| if [ "$ENABLE_VERBOSE_LOGGING" = "true" ]; then | |
| poetry run pytest --tb=native -n auto -v -s --capture=no | |
| else | |
| poetry run pytest --tb=native -n auto | |
| fi | |
| env: | |
| BNB_CHAIN_JSON_RPC: ${{ secrets.BNB_CHAIN_JSON_RPC }} | |
| JSON_RPC_POLYGON_ARCHIVE: ${{ secrets.JSON_RPC_POLYGON_ARCHIVE }} | |
| JSON_RPC_POLYGON: ${{ secrets.JSON_RPC_POLYGON }} | |
| JSON_RPC_ETHEREUM: ${{ secrets.JSON_RPC_ETHEREUM }} | |
| JSON_RPC_BASE: ${{ secrets.JSON_RPC_BASE }} | |
| JSON_RPC_BINANCE: ${{ secrets.JSON_RPC_BINANCE }} | |
| ETHEREUM_JSON_RPC: ${{ secrets.JSON_RPC_ETHEREUM }} | |
| GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }} | |
| GOOGLE_CLOUD_REGION: ${{ secrets.GOOGLE_CLOUD_REGION }} | |
| KEY_RING: ${{ secrets.KEY_RING }} | |
| KEY_NAME: ${{ secrets.KEY_NAME }} | |
| GCP_ADC_CREDENTIALS_STRING: ${{ secrets.GCP_ADC_CREDENTIALS_STRING }} | |
| TOKEN_RISK_API_KEY: ${{ secrets.TOKEN_RISK_API_KEY }} | |
| ARBITRUM_SEPOLIA_RPC_URL: ${{ secrets.ARBITRUM_SEPOLIA_RPC_URL }} | |
| ARBITRUM_GMX_TEST_SEPOLIA_PRIVATE_KEY: ${{ secrets.ARBITRUM_GMX_TEST_SEPOLIA_PRIVATE_KEY }} | |
| - name: Ruff lint check | |
| run: | | |
| poetry run ruff format --check --diff | |
| # Only run linting once (on the newest Python with latest web3.py) | |
| if: "matrix.python-version == '3.12' && matrix.web3-version == '7'" |