Skip to content

temp #12077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

temp #12077

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
360 changes: 14 additions & 346 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,358 +29,26 @@ on:
- master

jobs:
start-prod-server:
name: Test Production Server
deploy:
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 ]
- uses: actions/checkout@v2

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: Start timer
run: echo "::set-output name=start::$(date +%s)"
id: timer_start

- name: Assert pnpm-lock.yaml is correct
- name: Install Heroku CLI
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

curl https://cli-assets.heroku.com/install.sh | sh

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
- name: End timer and show duration
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
end=$(date +%s)
duration=$((end - ${{ steps.timer_start.outputs.start }}))
echo "Duration: ${duration} seconds"

# 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
- name: Deploy to Heroku
run: |
chmod -R 755 ./libs/adapters/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/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
chmod +x ./scripts/deploy-to-heroku.sh
./scripts/deploy-to-heroku.sh "${{ secrets.HEROKU_EMAIL }}" "${{ secrets.HEROKU_API_TOKEN }}" commonwealth-frick
Loading
Loading