Merge pull request #10893 from hicommonwealth/israel.10890.unable-to-… #30523
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
PRIVATE_KEY: '0x83c65f24efbc8f4bc54ad425e897fc3ea01f760d5e71671a30eacb075ebe2313' | |
USES_DOCKER_PGSQL: true | |
PORT: 8080 | |
REDIS_URL: redis://localhost:6379 | |
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: | |
workflow_dispatch: | |
inputs: | |
pr_number: | |
description: "PR number to test (optional)" | |
required: false | |
type: number | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
start-prod-server: | |
name: Test Production Server | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
node: [ 22 ] | |
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: | |
ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
- 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@v4 | |
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: [ 22 ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
- 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: [ 22 ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
- 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: [ 22 ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
- 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: [ 22 ] | |
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 | |
with: | |
ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
- 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: [ 22 ] | |
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 | |
with: | |
ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
- 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: [ 22 ] | |
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: | |
ref: ${{ github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number) || github.ref }} | |
- 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 | |
# Removed until we get image caching set up otherwise it will fail due to dockerhub rate limiting | |
# commonwealth-e2e-evm-tests: | |
# name: EVM devnet integration Tests | |
# runs-on: ubuntu-latest | |
# timeout-minutes: 10 | |
# strategy: | |
# matrix: | |
# node: [ 22 ] | |
# | |
# 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: Run EVM devnet integration tests | |
# run: pnpm -F commonwealth test-devnet:integration --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: [ 22 ] | |
steps: | |
- name: Coveralls Finished | |
uses: coverallsapp/github-action@v2 | |
with: | |
parallel-finished: true |