Files
parser2/.github/workflows/ci.yml
T
coopops 1ee77e3427
CI / Lint (pull_request) Successful in 9m22s
CI / Typecheck (pull_request) Successful in 9m25s
CI / Unit tests (pull_request) Successful in 9m34s
CI / Integration tests (pull_request) Failing after 4m56s
CI / Build (pull_request) Has been skipped
ci: увеличить бюджет ожидания Chain API до 120 попыток + curl --max-time
На нагруженном раннере nodeos поднимался >6 мин (cache restore тоже ловил
ETIMEDOUT), а curl без --max-time подвисал на ещё-не-отвечающем порту и съедал
60-попыточный бюджет — integration падал на 'Chain API did not become ready'
при здоровой ноде. Узел не крашился (лог сплошь info), нужен лишь запас времени.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-25 17:16:40 +00:00

132 lines
4.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: CI
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with: { version: '10' }
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'pnpm' }
- run: pnpm install --frozen-lockfile
- run: pnpm audit --audit-level=high
continue-on-error: true
typecheck:
name: Typecheck
runs-on: ubuntu-22.04
needs: lint
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with: { version: '10' }
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'pnpm' }
- run: pnpm install --frozen-lockfile
- run: pnpm --filter @coopenomics/coopos-ship-reader build
- run: pnpm --filter @coopenomics/parser2 typecheck
unit:
name: Unit tests
runs-on: ubuntu-22.04
needs: typecheck
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with: { version: '10' }
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'pnpm' }
- run: pnpm install --frozen-lockfile
- run: pnpm --filter @coopenomics/coopos-ship-reader build
- run: pnpm --filter @coopenomics/parser2 test:unit -- --reporter=verbose --coverage
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
integration:
name: Integration tests
runs-on: ubuntu-22.04
needs: unit
services:
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with: { version: '10' }
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'pnpm' }
- run: pnpm install --frozen-lockfile
- run: pnpm --filter @coopenomics/coopos-ship-reader build
# Parser2 build: нужен dist/deserialize.worker.cjs для Piscina worker pool
- run: pnpm --filter @coopenomics/parser2 build
# Запускаем nodeos вручную через docker run: образ dicoop/blockchain:v5.1.0-dev
# не имеет CMD по умолчанию, и GitHub Actions services: не поддерживает
# передачу команды контейнеру. Монтируем config.ini (SHiP на 8080) и genesis.json.
- name: Start blockchain node
run: |
docker run -d --name blockchain \
-p 8888:8888 -p 8080:8080 -p 9876:9876 \
-v "${GITHUB_WORKSPACE}/packages/parser2/test/integration/node-config:/mnt/dev/config" \
dicoop/blockchain:v5.1.0-dev \
/bin/bash -c '/usr/local/bin/nodeos -d /mnt/dev/data -p eosio --config-dir /mnt/dev/config --genesis-json /mnt/dev/config/genesis.json --disable-replay-opts'
sleep 3
- name: Wait for Chain API
run: |
# Бюджет 120 попыток × (≤2с curl + 2с sleep) ≈ до 8 мин: на нагруженном
# раннере nodeos поднимается медленно (наблюдали >6 мин до get_info), а
# curl без --max-time подвисал на ещё-не-отвечающем порту и съедал бюджет.
for i in $(seq 1 120); do
if curl -sf --max-time 2 http://localhost:8888/v1/chain/get_info > /dev/null 2>&1; then
echo "Chain API ready after $i attempts"
exit 0
fi
echo " attempt $i/120..."
sleep 2
done
echo "ERROR: Chain API did not become ready. Container logs:"
docker logs blockchain | tail -100
exit 1
- run: pnpm --filter @coopenomics/parser2 test:integration
env:
REDIS_URL: redis://localhost:6379
CHAIN_URL: http://localhost:8888
SHIP_URL: ws://localhost:8080
- name: Show blockchain logs on failure
if: failure()
run: docker logs blockchain | tail -200
build:
name: Build
runs-on: ubuntu-22.04
needs: integration
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with: { version: '10' }
- uses: actions/setup-node@v4
with: { node-version: '20', cache: 'pnpm' }
- run: pnpm install --frozen-lockfile
- run: pnpm --filter @coopenomics/coopos-ship-reader build
- run: pnpm --filter @coopenomics/parser2 build