Run Analytics on native PostgreSQL (#5) #8
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [main, integration/editions-refactor] | |
| pull_request: | |
| branches: [main, integration/editions-refactor] | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| script-audit: | |
| name: Script audit | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 9.0.0 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.19.0 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Audit package scripts | |
| run: pnpm script:audit | |
| - name: Audit Community and Cloud boundary | |
| run: | | |
| pnpm boundary:audit | |
| fixture="$(mktemp)" | |
| printf '%s\n' 'docker-compose.prod.yml' > "$fixture" | |
| if node scripts/ci/community-boundary.mjs --paths-file "$fixture"; then | |
| echo "Community boundary accepted a managed-production path." >&2 | |
| exit 1 | |
| fi | |
| printf '%s\n' '.github/workflows/deploy-production.yml' > "$fixture" | |
| if node scripts/ci/community-boundary.mjs --paths-file "$fixture"; then | |
| echo "Community boundary accepted an official deployment workflow." >&2 | |
| exit 1 | |
| fi | |
| mkdir -p packages/boundary-fixture | |
| printf '%s\n' "import '@humanly-ee/not-allowed';" > packages/boundary-fixture/index.ts | |
| if pnpm boundary:audit; then | |
| echo "Community boundary accepted an unregistered core-to-EE import." >&2 | |
| exit 1 | |
| fi | |
| rm -rf packages/boundary-fixture | |
| pnpm boundary:audit | |
| - name: Audit quickstart database bootstrap | |
| run: | | |
| grep -F 'image: timescale/timescaledb:2.28.2-pg15' docker-compose.quickstart.yml | |
| grep -F 'cat /proc/1/comm' docker-compose.quickstart.yml | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 9.0.0 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.19.0 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run lint checks | |
| run: pnpm lint | |
| typecheck: | |
| name: Type check (${{ matrix.edition }}) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| edition: [community, cloud] | |
| env: | |
| EDITION: ${{ matrix.edition }} | |
| NEXT_PUBLIC_EDITION: ${{ matrix.edition }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 9.0.0 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.19.0 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run TypeScript checks | |
| run: | | |
| pnpm type-check | |
| if [ "$EDITION" = "cloud" ]; then | |
| pnpm --filter '@humanly-ee/*' --if-present type-check | |
| fi | |
| test-runnable: | |
| name: Runnable tests (${{ matrix.edition }}) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| edition: [community, cloud] | |
| env: | |
| EDITION: ${{ matrix.edition }} | |
| NEXT_PUBLIC_EDITION: ${{ matrix.edition }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 9.0.0 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.19.0 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run runnable tests | |
| run: pnpm test:runnable | |
| - name: Verify Analytics on PostgreSQL 15 | |
| run: pnpm --filter @humanly/backend test:analytics-postgres | |
| - name: Audit discovered tests | |
| run: pnpm test:audit | |
| build: | |
| name: Build all packages (${{ matrix.edition }}) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| edition: [community, cloud] | |
| env: | |
| EDITION: ${{ matrix.edition }} | |
| NEXT_PUBLIC_EDITION: ${{ matrix.edition }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 9.0.0 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.19.0 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run production build checks | |
| run: | | |
| if [ "$EDITION" = "cloud" ]; then | |
| pnpm build:ee:billing | |
| fi | |
| pnpm build:all | |
| docker-smoke: | |
| name: Docker build smoke (${{ matrix.edition }}) | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 60 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| edition: [community, cloud] | |
| env: | |
| EDITION: ${{ matrix.edition }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 9.0.0 | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.19.0 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Build and inspect edition images | |
| run: | | |
| if [ "$EDITION" = "cloud" ]; then | |
| backend_file=ee/docker/backend.Dockerfile | |
| writer_file=ee/docker/frontend-user.Dockerfile | |
| publisher_file=ee/docker/frontend.Dockerfile | |
| else | |
| backend_file=docker/backend.Dockerfile | |
| writer_file=docker/frontend-user.Dockerfile | |
| publisher_file=docker/frontend.Dockerfile | |
| fi | |
| docker buildx build --load \ | |
| --file "$backend_file" \ | |
| --tag "humanly-backend:${EDITION}-ci" \ | |
| --build-arg "EDITION=$EDITION" \ | |
| . | |
| docker buildx build --load \ | |
| --file "$writer_file" \ | |
| --tag "humanly-frontend-user:${EDITION}-ci" \ | |
| --build-arg NEXT_PUBLIC_API_URL=https://api.example.test/api/v1 \ | |
| --build-arg NEXT_PUBLIC_WS_URL=https://api.example.test \ | |
| --build-arg "NEXT_PUBLIC_EDITION=$EDITION" \ | |
| . | |
| docker buildx build --load \ | |
| --file "$publisher_file" \ | |
| --tag "humanly-frontend:${EDITION}-ci" \ | |
| --build-arg NEXT_PUBLIC_API_URL= \ | |
| --build-arg NEXT_PUBLIC_WS_URL=wss://publisher.example.test \ | |
| --build-arg NEXT_PUBLIC_TRACKER_URL=https://publisher.example.test/tracker/humanly-tracker.min.js \ | |
| --build-arg NEXT_PUBLIC_BASE_PATH= \ | |
| --build-arg "NEXT_PUBLIC_EDITION=$EDITION" \ | |
| . | |
| scripts/ci/assert-edition-image.sh "humanly-backend:${EDITION}-ci" "$EDITION" backend | |
| scripts/ci/assert-edition-image.sh "humanly-frontend-user:${EDITION}-ci" "$EDITION" frontend-user | |
| scripts/ci/assert-edition-image.sh "humanly-frontend:${EDITION}-ci" "$EDITION" frontend |