Skip to content

fix: update reaction deletion logic and improve test assertions #28674

fix: update reaction deletion logic and improve test assertions

fix: update reaction deletion logic and improve test assertions #28674

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 --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-integration-test:
name: Commonwealth 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 integration tests
run: pnpm -F commonwealth test-integration --allowOnly=false
commonwealth-unit-tests:
name: Commonwealth Unit 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 }}
- 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
- 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
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
report-coverage:
name: Upload Test Coverage Report
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [ commonwealth-unit-tests ]
if: always()
strategy:
matrix:
node: [ 20 ]
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true