Merge pull request #663 from lidofinance/fix/tem-ci-fix2 #9
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: Staking Modules Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - "master" | |
| - "feat/tests" | |
| - "feat/rc3" | |
| - "feat/rc2" | |
| - "feat/rc1" | |
| - "feat/next-vote" | |
| schedule: | |
| - cron: "0 0 * * TUE" | |
| jobs: | |
| staking-modules-regression: | |
| name: Staking Modules regression tests | |
| runs-on: "ubuntu-latest" | |
| timeout-minutes: 120 | |
| concurrency: | |
| group: staking-modules-regression-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| NODE_VERSION: '20' | |
| PYTHON_VERSION: '3.10' | |
| POETRY_VERSION: '1.8.2' | |
| HARDHAT_NODE_URL: 'http://127.0.0.1:8545' | |
| CURL_PARAMS: '-X POST -H "Content-Type: application/json" -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}"' | |
| steps: | |
| - name: Checkout scripts repository | |
| uses: actions/checkout@v4 | |
| with: | |
| path: scripts | |
| persist-credentials: false | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'yarn' | |
| cache-dependency-path: scripts/yarn.lock | |
| - name: Install Poetry | |
| shell: bash | |
| run: | | |
| curl -sSL https://install.python-poetry.org | python3 - | |
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" | |
| env: | |
| POETRY_VERSION: ${{ env.POETRY_VERSION }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: "poetry" | |
| cache-dependency-path: scripts/poetry.lock | |
| - name: Install Python dependencies with Poetry | |
| run: poetry install | |
| working-directory: scripts | |
| - name: Install Yarn dependencies for scripts | |
| run: yarn install --frozen-lockfile | |
| working-directory: scripts | |
| - name: Start Hardhat node | |
| shell: bash | |
| run: | | |
| npx hardhat node --fork ${{ secrets.ETH_RPC_URL }} & | |
| for i in {1..30}; do | |
| if curl -sf ${{ env.HARDHAT_NODE_URL }} ${{ env.CURL_PARAMS }} | grep -q '"result"'; then | |
| echo "Hardhat node is ready" | |
| exit 0 | |
| fi | |
| echo "Hardhat node is not ready yet... ($i/30)" | |
| sleep 1 | |
| done | |
| echo "Hardhat node was not ready after 30 seconds" >&2 | |
| exit 1 | |
| working-directory: scripts | |
| - name: Import network config for brownie | |
| shell: bash | |
| run: poetry run brownie networks import network-config.yaml True | |
| working-directory: scripts | |
| - name: Capture pre-vote block for staking modules regression | |
| id: modules-regression-vote-block | |
| shell: bash | |
| run: | | |
| vote_prev_block=$(make --no-print-directory __get_rpc_latest_block_number CORE_TESTS_TARGET_RPC_URL=${{ env.HARDHAT_NODE_URL }}) | |
| echo "vote_prev_block=$vote_prev_block" >> "$GITHUB_OUTPUT" | |
| working-directory: scripts | |
| - name: Prepare test environment with Brownie | |
| run: DG_PROPOSAL_IDS=12 PYTHONPATH=$PWD poetry run brownie run scripts/ci/prepare_environment --network mfh-1 | |
| working-directory: scripts | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ETHERSCAN_TOKEN: ${{ secrets.ETHERSCAN_TOKEN }} | |
| - name: Run staking modules regression tests | |
| uses: lidofinance/staking-modules/.github/actions/regression-tests@develop | |
| env: | |
| DG_PROPOSAL_IDS: "12" | |
| with: | |
| repository: lidofinance/staking-modules | |
| ref: post-vote-test | |
| path: staking-modules | |
| rpc_url: ${{ env.HARDHAT_NODE_URL }} | |
| vote_prev_block: ${{ steps.modules-regression-vote-block.outputs.vote_prev_block }} |