Skip to content

Forked CSM-widget Tests. Env [testnet] #2

Forked CSM-widget Tests. Env [testnet]

Forked CSM-widget Tests. Env [testnet] #2

Workflow file for this run

name: Forked Test CSM-widget
run-name: Forked CSM-widget Tests. Env [${{ github.event.inputs.stand_type || 'testnet' }}]
on:
schedule:
- cron: "0 6 * * *" # Every day at 6 AM UTC
workflow_dispatch:
inputs:
stand_type:
description: "Stand type"
required: true
type: choice
default: testnet
options:
- testnet
- preview
preview_stand_url:
description: 'Preview stand url (only if "Stand type" is "preview")'
required: false
type: string
preview_stand_env:
description: 'Preview stand env (only if "Stand type" is "preview")'
required: false
type: choice
default: testnet
options:
- testnet
- infra
jobs:
bootstrap:
name: Bootstrap environment
runs-on: ubuntu-latest
outputs:
cache-path: ${{ steps.cache.outputs.path }}
cache-key: ${{ steps.cache.outputs.key }}
env:
JUST_TAG: 1.24.0
steps:
- name: Build cache params
id: cache
run: |
echo "path=$CACHE_PATH" >> "$GITHUB_OUTPUT"
echo "$KEY_INPUT" | md5sum | awk '{print $1}' | xargs -I% echo "key=cargobin-%-${RUNNER_OS}" >> "$GITHUB_OUTPUT"
env:
CACHE_PATH: |
~/.cargo/bin/
KEY_INPUT: |
just:${{env.JUST_TAG}}
- uses: actions/cache@v4
id: get-cache
with:
path: ${{ steps.cache.outputs.path }}
key: ${{ steps.cache.outputs.key }}
- name: Install just
run: cargo install "just@$JUST_TAG"
if: steps.get-cache.outputs.cache-hit != 'true'
test:
runs-on: ubuntu-24.04
needs: bootstrap
env:
# Required envs
RPC_URL: ${{ secrets.RPC_URL }}
WALLET_SECRET_PHRASE: ${{ secrets.WALLET_SECRET_PHRASE }}
WALLET_PASSWORD: ${{ secrets.WALLET_PASSWORD }}
EMPTY_SECRET_PHRASE: ${{ secrets.EMPTY_SECRET_PHRASE }}
EMPTY_NODE_SECRET_PHRASE: ${{ secrets.EMPTY_NODE_SECRET_PHRASE }}
STAND_TYPE: ${{ inputs.stand_type || github.event.inputs.STAND_TYPE || 'testnet' }}
# Common envs
QASE_API_TOKEN: ${{ secrets.QASE_API_TOKEN }}
QASE_PROJECT_ID: "CSM"
QASE_PLAN_ID: "8"
GH_ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
GH_BRANCH_REF_NAME: ${{ github.ref_name }}
GH_EVENT_NAME: ${{ github.event_name }}
NODE_OPTIONS: --max-old-space-size=4096
TEST_TAGS: "forked"
TEST_BRANCH: ${{ github.event.inputs.branch }}
REPORT_ENABLED: "${{ github.event_name == 'schedule' && 'true' || 'false' }}"
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL}}
SLACK_DUTY_TAG: "S09H269H2TT"
# Optional envs
REFUSE_CF_BLOCK_NAME: ${{ secrets.REFUSE_CF_BLOCK_NAME }}
REFUSE_CF_BLOCK_VALUE: ${{ secrets.REFUSE_CF_BLOCK_VALUE }}
PUSHGATEWAY_URL: ${{ secrets.PUSHGATEWAY_URL }}
PUSHGATEWAY_USERNAME: ${{ secrets.PUSHGATEWAY_USERNAME }}
PUSHGATEWAY_PASSWORD: ${{ secrets.PUSHGATEWAY_PASSWORD }}
GRAFANA_URL: ${{ secrets.GRAFANA_URL }}
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
# Forked test envs
USE_FORK: true
DEPLOY_CONFIG: ./artifacts/hoodi/deploy-hoodi.json
CHAIN: hoodi
ARTIFACTS_DIR: ./artifacts/hoodi/
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
- name: Checkout community-staking-module
uses: actions/checkout@v4
with:
repository: lidofinance/community-staking-module
path: community-staking-module
- uses: actions/cache@v4
with:
path: ${{ needs.bootstrap.outputs.cache-path }}
key: ${{ needs.bootstrap.outputs.cache-key }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.2.3
- name: Restore yarn cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
- name: Install CSM Contracts dependencies
run: |
cd community-staking-module && yarn install --immutable
- name: Build CSM Fork
run: cd community-staking-module && just deps && just build
- name: Install dependencies
run: yarn install --immutable
- name: Install Playwright Browsers
run: yarn playwright install chromium --with-deps
# - name: Download keys generator binary
# run: bash ./tests/scripts/set_up_keys_generator.sh
- name: Set up preview-stand credentials
if: ${{ inputs.stand_type == 'preview' || github.event.inputs.stand_type == 'preview' }}
run: |
if [ -n "${{ inputs.preview_stand_url || github.event.inputs.preview_stand_url }}" ]; then
echo "Setting login and password for preview stand"
echo "PREVIEW_STAND_LOGIN=${{ secrets.PREVIEW_STAND_LOGIN }}" >> $GITHUB_ENV
echo "PREVIEW_STAND_PASSWORD=${{ secrets.PREVIEW_STAND_PASSWORD }}" >> $GITHUB_ENV
echo "PREVIEW_STAND_URL=${{ inputs.preview_stand_url || github.event.inputs.preview_stand_url }}" >> $GITHUB_ENV
echo "PREVIEW_STAND_ENV=${{ github.event.inputs.preview_stand_env }}" >> $GITHUB_ENV
else
echo "PREVIEW_STAND_URL not provided for preview environment"
exit 1
fi
- name: Run tests based on suite input
run: |
echo -e "\033[34m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
echo -e "🚀 Running on Stand Type: \033[1;34m$STAND_TYPE\033[0m"
echo -e "🧪 Test Tags: \033[1;34m$TEST_TAGS\033[0m"
echo -e "🌱 Branch: \033[1;34m${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}\033[0m"
echo -e "🔗 Test Plan: \033[1;34m${QASE_PLAN_ID}\033[0m"
echo -e "\033[34m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\033[0m"
xvfb-run --auto-servernum -- yarn test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 1