Skip to content

change the logic of show more from number of lines to number characters #27662

change the logic of show more from number of lines to number characters

change the logic of show more from number of lines to number characters #27662

Workflow file for this run

name: CI
env:
APP_ENV: CI
IS_CI: true
CI: true # ensures Vitest allowOnly option is false so no tests are accidentally skipped
NODE_ENV: 'test'
ROLLBAR_ENV: 'GitHubCI'
TEST_WITHOUT_LOGS: 'true'
ALLOWED_EVENTS: 'ChainEventCreated,SnapshotProposalCreated,ThreadCreated,ThreadUpvoted,SubscriptionPreferencesUpdated,CommentCreated,UserMentioned'
PRIVATE_KEY: 'web3-pk'
USES_DOCKER_PGSQL: true
PORT: 8080
REDIS_URL: redis://localhost:6379
ENTITIES_URL: ${{ secrets.ENTITIES_URL }}
GITHUB_BASE_REF: ${{ github.base_ref }}
FEDERATION_POSTGRES_DB_URL: postgresql://commonwealth:edgeware@localhost/common_test
ALCHEMY_PRIVATE_APP_KEY: ${{ secrets.ALCHEMY_PRIVATE_APP_KEY }}
ALCHEMY_PUBLIC_APP_KEY: ${{ secrets.ALCHEMY_PUBLIC_APP_KEY }}
on:
pull_request:
merge_group:
push:
branches:
- master
jobs:
# These tests run slowly, so run them in a separate job. NOTE: if you change the name of this job, also change
# Its references in this file
e2e-tests-Parallel:
name: Commonwealth E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
node: [ 20 ]
services:
postgres:
image: hicommonwealth/cw_postgres:latest
env:
POSTGRES_USER: commonwealth
POSTGRES_DB: common_test
POSTGRES_PASSWORD: edgeware
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/e2e
- name: Run e2e tests
run: |
sudo local-ssl-proxy --source 443 --target 8080 &
pnpm -F commonwealth e2e-start-server --forbid-only &
pnpm -F commonwealth wait-server &&
pnpm -F commonwealth test-e2e --forbid-only
- name: Archive test status
uses: actions/upload-artifact@v3
with:
name: FlakySuiteStatus
path: packages/commonwealth/summary.json
- name: Upload e2e recordings on failure
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: Recordings
path: packages/commonwealth/test-results/
# The tests that this job runs should not be flaky. If they are, move them back into the regular suite.
e2e-tests-Mature:
name: Commonwealth Mature E2E Tests
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
node: [ 20 ]
services:
postgres:
image: hicommonwealth/cw_postgres:latest
env:
POSTGRES_USER: commonwealth
POSTGRES_DB: common_test
POSTGRES_PASSWORD: edgeware
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/e2e
- name: Run e2e tests
run: |
sudo local-ssl-proxy --source 443 --target 8080 &
pnpm -F commonwealth e2e-start-server --forbid-only &
pnpm -F commonwealth wait-server &&
pnpm -F commonwealth test-e2e-mature --forbid-only
- name: Archive test status
uses: actions/upload-artifact@v3
with:
name: MatureSuiteStatus
path: packages/commonwealth/summary.json
- name: Upload e2e recordings on failure
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: Recordings
path: packages/commonwealth/test-results/
e2e-tests-serial:
name: Commonwealth E2E Tests Serial
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node: [ 20 ]
services:
postgres:
image: hicommonwealth/cw_postgres:latest
env:
POSTGRES_USER: commonwealth
POSTGRES_DB: common_test
POSTGRES_PASSWORD: edgeware
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- uses: ./.github/actions/e2e
- name: Build server
run: pnpm -F commonwealth build
- name: Run serial e2e tests
run: |
pnpm -F commonwealth bootstrap-test-db &&
(cd packages/commonwealth && NODE_OPTIONS=--max-old-space-size=$(../../scripts/get-max-old-space-size.sh) node --import=extensionless/register --enable-source-maps ./build/server.js) &
(pnpm -F commonwealth wait-server && pnpm -F commonwealth test-e2e-serial --forbid-only)
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: coverage
# Lint with recommendations
commonwealth-code-quality-recommendations:
name: Code Quality Recommendations
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node: [ 20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Run linter
run: pnpm lint-branch-warnings
# Lint and Typecheck
commonwealth-code-quality:
name: Code Quality checks
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node: [ 20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Assert pnpm-lock.yaml is correct
run: |
if ! git diff --quiet; then
echo 'You need to update the pnpm-lock.yaml file (potentially after installing node-gyp)'
exit 1
fi
- name: build
run: pnpm -r build
- name: check-types
run: pnpm -r check-types
# To disable eslint-diff just comment the following two lines
- name: Run eslint-diff
run: pnpm -r run lint-diff
- name: Run eslint-diff-canary to make sure eslint-diff is functioning properly
run: pnpm -F commonwealth run lint-diff-canary
# fun the *old* linter last because I want to try to migrate away from
# this and JUST to eslint-diff but if this fails we still might be able
# to salvage the branch
- name: Run linter
run: pnpm lint-branch
detect-broken-ts-expect-error:
name: Detect Broken TS expect errors
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node: [ 20 ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Assert pnpm-lock.yaml is correct
run: |
if ! git diff --quiet; then
echo 'You need to update the pnpm-lock.yaml file (potentially after installing node-gyp)'
exit 1
fi
- name: build
run: pnpm -r build
- name: run detect-broken-ts-expect-error.sh
run: cd packages/commonwealth && ./scripts/detect-broken-ts-expect-error.sh
# These tests run quickly, so run them in a separate job
commonwealth-unit-integration:
name: Commonwealth Unit And Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
node: [ 20 ]
services:
postgres:
image: hicommonwealth/cw_postgres:latest
env:
POSTGRES_USER: commonwealth
POSTGRES_DB: common_test
POSTGRES_PASSWORD: edgeware
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
redis:
image: redis:latest
ports:
- 6379:6379
rabbitmq:
image: rabbitmq:3.11-management
ports:
- 5672:5672
- 15672:15672
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
# TODO: use devmode instead to avoid building
- name: Build
run: pnpm -r build
- name: Run unit tests
run: pnpm -r test -- --allowOnly=false
- name: Change permissions of coverage files
run: |
chmod -R 755 ./libs/adapters/coverage/lcov.info
chmod -R 755 ./libs/core/coverage/lcov.info
chmod -R 755 ./libs/model/coverage/lcov.info
chmod -R 755 ./libs/sitemaps/coverage/lcov.info
chmod -R 755 ./packages/commonwealth/coverage/lcov.info
chmod -R 755 ./packages/discord-bot/coverage/lcov.info
chmod -R 755 ./packages/scripts/coverage/lcov.info
chmod -R 755 ./packages/snapshot-listener/coverage/lcov.info
- name: Coveralls parallel
uses: coverallsapp/github-action@v2
with:
flag-name: unit-test-coverage
parallel: true
files: libs/adapters/coverage/lcov.info libs/core/coverage/lcov.info libs/model/coverage/lcov.info libs/sitemaps/coverage/lcov.info packages/commonwealth/coverage/lcov.info packages/discord-bot/coverage/lcov.info packages/scripts/coverage/lcov.info packages/snapshot-listener/coverage/lcov.info
- name: Run integration tests
run: pnpm -F commonwealth test-integration --allowOnly=false
- name: Coveralls parallel
uses: coverallsapp/github-action@v2
with:
flag-name: integration-test-coverage
parallel: true
files: ./packages/commonwealth/coverage/lcov.info
commonwealth-evm-tests:
name: EVM Devnet Tests
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node: [ 20 ]
services:
postgres:
image: hicommonwealth/cw_postgres:latest
env:
POSTGRES_USER: commonwealth
POSTGRES_DB: common_test
POSTGRES_PASSWORD: edgeware
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Run EVM Devnet tests
run: pnpm -F commonwealth test-devnet:evm --allowOnly=false
- name: Coveralls parallel
uses: coverallsapp/github-action@v2
with:
flag-name: evm-devnet-test-coverage
parallel: true
files: packages/commonwealth/coverage/lcov.info
# These tests run slowly, so run them in a separate job
commonwealth-cosmos-tests:
name: Cosmos Devnet Tests
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
matrix:
node: [ 20 ]
services:
postgres:
image: hicommonwealth/cw_postgres:latest
env:
POSTGRES_USER: commonwealth
POSTGRES_DB: common_test
POSTGRES_PASSWORD: edgeware
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
cosmos_test_app:
image: mhagel1/csdk-v1
ports:
- 5051:5051
cosmos_beta_test_app:
image: mhagel1/csdk-beta
ports:
- 5050:5050
evmos_test_app:
image: mhagel1/evmos-dev
ports:
- 5052:5052
redis:
image: redis:latest
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node }}
## Cosmos Section:
# We only run Cosmos devnet tests if any files in the following folders changes
- name: Get changed Cosmos devnet-related files
id: changed-files-specific
uses: tj-actions/changed-files@v35
with:
files: |
packages/commonwealth/test/devnet/cosmos/**/*
packages/commonwealth/server/cosmos-gov-notifications/**/*
packages/commonwealth/test/integration/cosmosGovNotifGenerator.spec.ts
packages/commonwealth/server/util/cosmosProxy.ts
packages/commonwealth/client/scripts/controllers/chain/cosmos/gov/**/*
packages/commonwealth/test/util/cosmos-chain-testing/**/*
libs/chains/src/cosmos-ts/**/*
- name: Run following steps if any file(s) in the Cosmos folders change
if: steps.changed-files-specific.outputs.all_changed_files
run: |
echo "One or more Cosmos Devnet-related files has changed."
echo "List all the files that have changed: ${{ steps.changed-files-specific.outputs.all_changed_files }}"
- name: Run Cosmos Devnet tests
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
pnpm -F commonwealth start &
(pnpm -F commonwealth wait-server && pnpm -F commonwealth test-devnet:cosmos --allowOnly=false)
- name: Coveralls parallel
if: steps.changed-files-specific.outputs.all_changed_files
uses: coverallsapp/github-action@v2
with:
flag-name: cosmos-devnet-test-coverage
parallel: true
files: packages/commonwealth/coverage/lcov.info
report-coverage:
name: Upload Test Coverage Report
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [ commonwealth-cosmos-tests, commonwealth-evm-tests, commonwealth-unit-integration, e2e-tests-serial, e2e-tests-Parallel, e2e-tests-Mature ]
if: always()
strategy:
matrix:
node: [ 20 ]
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "cosmos-devnet-test-coverage"