feat(analytics): add clickhouse #47
Workflow file for this run
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 Analytics | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| CLICKHOUSE_SETUP_CACHE_KEY: clickhouse-setup | |
| jobs: | |
| changed-files-check: | |
| uses: ./.github/workflows/changed-files.yaml | |
| with: | |
| files: | | |
| package.json | |
| packages/twenty-server/src/database/clickhouse/** | |
| packages/twenty-server/src/engine/core-modules/analytics/** | |
| clickhouse: | |
| needs: changed-files-check | |
| if: needs.changed-files-check.outputs.any_changed == 'true' | |
| timeout-minutes: 10 | |
| runs-on: depot-ubuntu-24.04-8 | |
| env: | |
| NX_REJECT_UNKNOWN_LOCAL_CACHE: 0 | |
| CLICKHOUSE_PASSWORD: ${{ secrets.CLICKHOUSE_CI_PASSWORD }} | |
| services: | |
| clickhouse: | |
| image: clickhouse/clickhouse-server:latest | |
| ports: | |
| - 8123:8123 | |
| - 9000:9000 | |
| env: | |
| CLICKHOUSE_PASSWORD: ${{ secrets.CLICKHOUSE_CI_PASSWORD }} | |
| options: >- | |
| --health-cmd "clickhouse-client --password=$CLICKHOUSE_PASSWORD --query='SELECT 1'" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Fetch custom Github Actions and base branch history | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| uses: ./.github/workflows/actions/yarn-install | |
| - name: Restore clickhouse setup | |
| id: restore-clickhouse-setup-cache | |
| uses: ./.github/workflows/actions/restore-cache | |
| with: | |
| key: ${{ env.CLICKHOUSE_SETUP_CACHE_KEY }} | |
| - name: Server / Build | |
| run: npx nx build twenty-server | |
| - name: Server / Write .env | |
| run: npx nx reset:env twenty-server | |
| - name: Update .env for ClickHouse | |
| run: | | |
| echo -e "\nCLICKHOUSE_URL=http://default:$CLICKHOUSE_PASSWORD@localhost:8123/twenty-test" >> packages/twenty-server/.env | |
| - name: Run ClickHouse migrations | |
| run: npx nx clickhouse:migrate twenty-server | |
| - name: Save clickhouse setup | |
| uses: ./.github/workflows/actions/save-cache | |
| with: | |
| key: ${{ steps.restore-clickhouse-setup-cache.outputs.cache-primary-key }} |