diff --git a/.github/workflows/ci-hog.yml b/.github/workflows/ci-hog.yml index 69a3bc3d5f133..ea51f70721f5c 100644 --- a/.github/workflows/ci-hog.yml +++ b/.github/workflows/ci-hog.yml @@ -48,25 +48,23 @@ jobs: hog-tests: needs: changes timeout-minutes: 30 - name: Hog tests runs-on: ubuntu-24.04 + if: needs.changes.outputs.hog == 'true' steps: # If this run wasn't initiated by the bot (meaning: snapshot update) and we've determined # there are backend changes, cancel previous runs - uses: n1hility/cancel-previous-runs@v3 - if: github.actor != 'posthog-bot' && needs.changes.outputs.hog == 'true' + if: github.actor != 'posthog-bot' with: token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v3 - if: needs.changes.outputs.hog == 'true' with: fetch-depth: 1 - name: Set up Python - if: needs.changes.outputs.hog == 'true' uses: actions/setup-python@v5 with: python-version: 3.11.9 @@ -76,31 +74,25 @@ jobs: # uv is a fast pip alternative: https://github.com/astral-sh/uv/ - run: pip install uv - if: needs.changes.outputs.hog == 'true' - name: Install SAML (python3-saml) dependencies - if: needs.changes.outputs.hog == 'true' run: | sudo apt-get update sudo apt-get install libxml2-dev libxmlsec1 libxmlsec1-dev libxmlsec1-openssl - name: Install Python dependencies - if: needs.changes.outputs.hog == 'true' run: | uv pip install --system -r requirements.txt -r requirements-dev.txt - name: Install pnpm - if: needs.changes.outputs.hog == 'true' uses: pnpm/action-setup@v4 - name: Set up Node.js - if: needs.changes.outputs.hog == 'true' uses: actions/setup-node@v4 with: - node-version: 18.12.1 + node-version: 18 - name: Check if ANTLR definitions are up to date - if: needs.changes.outputs.hog == 'true' run: | cd .. sudo apt-get install default-jre @@ -123,27 +115,175 @@ jobs: ANTLR_VERSION: '4.13.2' - name: Check if STL bytecode is up to date - if: needs.changes.outputs.hog == 'true' run: | python -m hogvm.stl.compile git diff --exit-code - name: Run HogVM Python tests - if: needs.changes.outputs.hog == 'true' run: | pytest hogvm - name: Run HogVM TypeScript tests - if: needs.changes.outputs.hog == 'true' run: | cd hogvm/typescript pnpm install --frozen-lockfile pnpm run test - name: Run Hog tests - if: needs.changes.outputs.hog == 'true' run: | cd hogvm/typescript pnpm run build cd ../ ./test.sh && git diff --exit-code + + check-package-version: + name: Check HogVM TypeScript package version and detect an update + needs: hog-tests + if: needs.hog-tests.result == 'success' && needs.changes.outputs.hog == 'true' + runs-on: ubuntu-24.04 + outputs: + committed-version: ${{ steps.check-package-version.outputs.committed-version }} + published-version: ${{ steps.check-package-version.outputs.published-version }} + is-new-version: ${{ steps.check-package-version.outputs.is-new-version }} + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + - name: Check package version and detect an update + id: check-package-version + uses: PostHog/check-package-version@v2 + with: + path: hogvm/typescript + + release-hogvm: + name: Release new HogVM TypeScript version + runs-on: ubuntu-24.04 + needs: check-package-version + if: needs.changes.outputs.hog == 'true' && needs.check-package-version.outputs.is-new-version == 'true' + env: + COMMITTED_VERSION: ${{ needs.check-package-version.outputs.committed-version }} + PUBLISHED_VERSION: ${{ needs.check-package-version.outputs.published-version }} + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.11.9 + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' + token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} + - run: pip install uv + - name: Install SAML (python3-saml) dependencies + run: | + sudo apt-get update + sudo apt-get install libxml2-dev libxmlsec1 libxmlsec1-dev libxmlsec1-openssl + - name: Install Python dependencies + run: | + uv pip install --system -r requirements.txt -r requirements-dev.txt + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Set up Node 18 + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org + - name: Install package.json dependencies + run: cd hogvm/typescript && pnpm install + - name: Publish the package in the npm registry + run: cd hogvm/typescript && npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Sleep 60 seconds to allow npm to update the package + run: sleep 60 + + update-versions: + name: Update versions in package.json + runs-on: ubuntu-24.04 + needs: release-hogvm + if: always() # This ensures the job runs regardless of the result of release-hogvm + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} + + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Set up Node 18 + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org + + - name: Check for version mismatches + id: check-mismatch + run: | + # Extract committed version + HOGVM_VERSION=$(jq -r '.version' hogvm/typescript/package.json) + + # Compare dependencies in package.json + MAIN_VERSION=$(jq -r '.dependencies."@posthog/hogvm"' package.json | tr -d '^') + PLUGIN_VERSION=$(jq -r '.dependencies."@posthog/hogvm"' plugin-server/package.json | tr -d '^') + + echo "HOGVM_VERSION=$HOGVM_VERSION" + echo "MAIN_VERSION=$MAIN_VERSION" + echo "PLUGIN_VERSION=$PLUGIN_VERSION" + + # Set output if mismatches exist + if [[ "$HOGVM_VERSION" != "$MAIN_VERSION" || "$HOGVM_VERSION" != "$PLUGIN_VERSION" ]]; then + echo "mismatch=true" >> "$GITHUB_ENV" + else + echo "mismatch=false" >> "$GITHUB_ENV" + fi + + - name: Update package.json versions + if: env.mismatch == 'true' + run: | + VERSION=$(jq ".version" hogvm/typescript/package.json -r) + + retry_pnpm_install() { + local retries=0 + local max_retries=20 # 10 minutes total + local delay=30 + + while [[ $retries -lt $max_retries ]]; do + echo "Attempting pnpm install (retry $((retries+1))/$max_retries)..." + pnpm install --no-frozen-lockfile && break + echo "Install failed. Retrying in $delay seconds..." + sleep $delay + retries=$((retries + 1)) + done + + if [[ $retries -eq $max_retries ]]; then + echo "pnpm install failed after $max_retries attempts." + exit 1 + fi + } + + # Update main package.json + mv package.json package.old.json + jq --indent 4 '.dependencies."@posthog/hogvm" = "^'$VERSION'"' package.old.json > package.json + rm package.old.json + retry_pnpm_install + + # Update plugin-server/package.json + cd plugin-server + mv package.json package.old.json + jq --indent 4 '.dependencies."@posthog/hogvm" = "^'$VERSION'"' package.old.json > package.json + rm package.old.json + retry_pnpm_install + + - name: Commit updated package.json files + if: env.mismatch == 'true' + uses: EndBug/add-and-commit@v9 + with: + add: '["package.json", "pnpm-lock.yaml", "plugin-server/package.json", "plugin-server/pnpm-lock.yaml", "hogvm/typescript/package.json"]' + message: 'Update @posthog/hogvm version in package.json' + default_author: github_actions + github_token: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/release-hogvm.yml b/.github/workflows/release-hogvm.yml deleted file mode 100644 index 6c8480202b24d..0000000000000 --- a/.github/workflows/release-hogvm.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: 'Publish HogVM package' - -on: - push: - branches: - - main - - master - -jobs: - release: - name: Publish - runs-on: ubuntu-24.04 - defaults: - run: - working-directory: hogvm/typescript - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - - - name: Check package version and detect an update - id: check-package-version - uses: PostHog/check-package-version@v2 - with: - path: hogvm/typescript - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Set up Node - uses: actions/setup-node@v4 - if: steps.check-package-version.outputs.is-new-version == 'true' - with: - node-version: 18.12.1 - registry-url: https://registry.npmjs.org - cache: pnpm - cache-dependency-path: hogvm/typescript/pnpm-lock.yaml - - - name: Install dependencies - if: steps.check-package-version.outputs.is-new-version == 'true' - run: pnpm i --frozen-lockfile - - - name: Build - if: steps.check-package-version.outputs.is-new-version == 'true' - run: pnpm build - - - name: Publish the package in the npm registry - id: publish-package - if: steps.check-package-version.outputs.is-new-version == 'true' - run: | - pnpm publish --access public --tag latest - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown-edit--light.png b/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown-edit--light.png index 02bc921745ecd..00916265cd38b 100644 Binary files a/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown-edit--light.png and b/frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-breakdown-edit--light.png differ diff --git a/hogvm/typescript/package.json b/hogvm/typescript/package.json index 4e3af57e59561..c0c554a9133cc 100644 --- a/hogvm/typescript/package.json +++ b/hogvm/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@posthog/hogvm", - "version": "1.0.61", + "version": "1.0.64", "description": "PostHog Hog Virtual Machine", "types": "dist/index.d.ts", "source": "src/index.ts", diff --git a/package.json b/package.json index d24367e948792..595a183f78603 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@microlink/react-json-view": "^1.21.3", "@microsoft/fetch-event-source": "^2.0.1", "@monaco-editor/react": "4.6.0", - "@posthog/hogvm": "^1.0.61", + "@posthog/hogvm": "^1.0.64", "@posthog/icons": "0.9.2", "@posthog/plugin-scaffold": "^1.4.4", "@react-hook/size": "^2.1.2", diff --git a/plugin-server/package.json b/plugin-server/package.json index 1d46f73ad6c74..4878a53cef9a4 100644 --- a/plugin-server/package.json +++ b/plugin-server/package.json @@ -54,7 +54,7 @@ "@maxmind/geoip2-node": "^3.4.0", "@posthog/clickhouse": "^1.7.0", "@posthog/cyclotron": "file:../rust/cyclotron-node", - "@posthog/hogvm": "^1.0.61", + "@posthog/hogvm": "^1.0.64", "@posthog/plugin-scaffold": "1.4.4", "@sentry/node": "^7.49.0", "@sentry/profiling-node": "^0.3.0", diff --git a/plugin-server/pnpm-lock.yaml b/plugin-server/pnpm-lock.yaml index 685a4b68c5314..944b81ab2a4c9 100644 --- a/plugin-server/pnpm-lock.yaml +++ b/plugin-server/pnpm-lock.yaml @@ -47,8 +47,8 @@ dependencies: specifier: file:../rust/cyclotron-node version: file:../rust/cyclotron-node '@posthog/hogvm': - specifier: ^1.0.61 - version: 1.0.61(luxon@3.4.4) + specifier: ^1.0.64 + version: 1.0.64(luxon@3.4.4) '@posthog/plugin-scaffold': specifier: 1.4.4 version: 1.4.4 @@ -2794,8 +2794,8 @@ packages: engines: {node: '>=12'} dev: false - /@posthog/hogvm@1.0.61(luxon@3.4.4): - resolution: {integrity: sha512-zCwQp6Zn2F2/QNhd1/0IwpndhElVZ2pzsoh2IOZWapZ+jNo6y/taL3128Uwoiec01IYiPXF8EVYOJP7X4Woj+A==} + /@posthog/hogvm@1.0.64(luxon@3.4.4): + resolution: {integrity: sha512-s6l5IhrtfLWXapW7Bl/YDvwX7hng9ypmhGul6Tljxu4ea5TBgexowf9+BhIGKo2JIUzyaZbLvDwQpTQopR1qvA==} peerDependencies: luxon: ^3.4.4 dependencies: diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ff1979dfa7ebc..b753b5863fb37 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,8 +53,8 @@ dependencies: specifier: 4.6.0 version: 4.6.0(monaco-editor@0.49.0)(react-dom@18.2.0)(react@18.2.0) '@posthog/hogvm': - specifier: ^1.0.61 - version: 1.0.61(luxon@3.5.0) + specifier: ^1.0.64 + version: 1.0.64(luxon@3.5.0) '@posthog/icons': specifier: 0.9.2 version: 0.9.2(react-dom@18.2.0)(react@18.2.0) @@ -5446,8 +5446,8 @@ packages: resolution: {integrity: sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw==} dev: false - /@posthog/hogvm@1.0.61(luxon@3.5.0): - resolution: {integrity: sha512-zCwQp6Zn2F2/QNhd1/0IwpndhElVZ2pzsoh2IOZWapZ+jNo6y/taL3128Uwoiec01IYiPXF8EVYOJP7X4Woj+A==} + /@posthog/hogvm@1.0.64(luxon@3.5.0): + resolution: {integrity: sha512-s6l5IhrtfLWXapW7Bl/YDvwX7hng9ypmhGul6Tljxu4ea5TBgexowf9+BhIGKo2JIUzyaZbLvDwQpTQopR1qvA==} peerDependencies: luxon: ^3.4.4 dependencies: