|
| 1 | +name: CSM Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: # TODO remove after testing is complete |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - "master" |
| 9 | + - "feat/tests" |
| 10 | + - "feat/rc3" |
| 11 | + - "feat/rc2" |
| 12 | + - "feat/rc1" |
| 13 | + - "feat/next-vote" |
| 14 | + schedule: |
| 15 | + - cron: "0 0 * * TUE" |
| 16 | + |
| 17 | +jobs: |
| 18 | + csm-regression: |
| 19 | + name: CSM Regression tests |
| 20 | + runs-on: "ubuntu-latest" |
| 21 | + timeout-minutes: 120 |
| 22 | + |
| 23 | + concurrency: |
| 24 | + group: csm-regression-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | + env: |
| 28 | + NODE_VERSION: '20' |
| 29 | + PYTHON_VERSION: '3.10' |
| 30 | + POETRY_VERSION: '1.8.2' |
| 31 | + HARDHAT_NODE_URL: 'http://127.0.0.1:8545' |
| 32 | + CURL_PARAMS: '-X POST -H "Content-Type: application/json" -d "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":1}"' |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout scripts repository |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + path: scripts |
| 39 | + persist-credentials: false |
| 40 | + |
| 41 | + - name: Set up Node.js |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: ${{ env.NODE_VERSION }} |
| 45 | + cache: 'yarn' |
| 46 | + cache-dependency-path: scripts/yarn.lock |
| 47 | + |
| 48 | + - name: Install Poetry |
| 49 | + shell: bash |
| 50 | + run: | |
| 51 | + curl -sSL https://install.python-poetry.org | python3 - |
| 52 | + echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 53 | + env: |
| 54 | + POETRY_VERSION: ${{ env.POETRY_VERSION }} |
| 55 | + |
| 56 | + - name: Set up Python |
| 57 | + uses: actions/setup-python@v4 |
| 58 | + with: |
| 59 | + python-version: ${{ env.PYTHON_VERSION }} |
| 60 | + cache: "poetry" |
| 61 | + cache-dependency-path: scripts/poetry.lock |
| 62 | + |
| 63 | + - name: Install Python dependencies with Poetry |
| 64 | + run: poetry install |
| 65 | + working-directory: scripts |
| 66 | + |
| 67 | + - name: Install Yarn dependencies for scripts |
| 68 | + run: yarn install --frozen-lockfile |
| 69 | + working-directory: scripts |
| 70 | + |
| 71 | + - name: Start Hardhat node |
| 72 | + shell: bash |
| 73 | + run: | |
| 74 | + npx hardhat node --fork ${{ secrets.ETH_RPC_URL }} & |
| 75 | + for i in {1..30}; do |
| 76 | + if curl -sf ${{ env.HARDHAT_NODE_URL }} ${{ env.CURL_PARAMS }} | grep -q '"result"'; then |
| 77 | + echo "Hardhat node is ready" |
| 78 | + break |
| 79 | + fi |
| 80 | + sleep 1 |
| 81 | + done |
| 82 | + working-directory: scripts |
| 83 | + |
| 84 | + - name: Prepare test environment with Brownie |
| 85 | + run: poetry run brownie run scripts/ci/prepare_environment --network mainnet-fork |
| 86 | + working-directory: scripts |
| 87 | + |
| 88 | + - name: Run CSM regression tests |
| 89 | + uses: lidofinance/community-staking-module/.github/actions/regression-tests@regression-gh-action |
| 90 | + with: |
| 91 | + repository: lidofinance/community-staking-module |
| 92 | + ref: main |
| 93 | + path: community-staking-module |
| 94 | + rpc_url: ${{ env.HARDHAT_NODE_URL }} |
0 commit comments