Skip to content

chore: remove upstream Slack CI notification workflow #8

chore: remove upstream Slack CI notification workflow

chore: remove upstream Slack CI notification workflow #8

Workflow file for this run

name: Proto CI
on:
workflow_dispatch:
push:
branches: [master]
pull_request:
merge_group:
permissions:
contents: read
pull-requests: read
jobs:
changes:
runs-on: ubuntu-24.04
timeout-minutes: 5
if: github.repository == 'PostHog/posthog'
name: Determine need to run proto checks
outputs:
proto: ${{ steps.filter.outputs.proto || 'true' }}
steps:
- uses: actions/checkout@v6
with:
clean: false
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
if: github.event_name != 'push'
with:
filters: |
proto:
- 'proto/**'
- 'posthog/personhog_client/proto/generated/**'
- 'bin/generate_personhog_proto.sh'
- '.github/workflows/ci-proto.yml'
lint:
name: Lint proto definitions
needs: changes
if: needs.changes.outputs.proto == 'true'
runs-on: depot-ubuntu-22.04-4
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
with:
clean: false
- name: Install buf
uses: bufbuild/buf-action@8f4a1456a0ab6a1eb80ba68e53832e6fcfacc16c # v1.3.0
with:
setup_only: true
version: '1.50.0'
- name: Lint protos
run: buf lint proto/
breaking:
name: Check for breaking changes
needs: changes
if: needs.changes.outputs.proto == 'true'
runs-on: depot-ubuntu-22.04-4
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
with:
clean: false
- name: Install buf
uses: bufbuild/buf-action@8f4a1456a0ab6a1eb80ba68e53832e6fcfacc16c # v1.3.0
with:
setup_only: true
version: '1.50.0'
- name: Check for breaking changes
run: buf breaking proto/ --against 'https://github.com/PostHog/posthog.git#branch=master,subdir=proto'
python-codegen:
name: Check Python proto stubs are up to date
needs: changes
if: needs.changes.outputs.proto == 'true'
runs-on: depot-ubuntu-22.04-4
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
with:
clean: false
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install codegen tools
run: pip install grpcio-tools protoletariat ruff
- name: Regenerate Python proto stubs
run: bash bin/generate_personhog_proto.sh
- name: Check for diff
run: |
if ! git diff --exit-code posthog/personhog_client/proto/generated/; then
echo ""
echo "ERROR: Generated Python proto stubs are out of date."
echo "Run 'bash bin/generate_personhog_proto.sh' and commit the result."
exit 1
fi
echo "Generated Python proto stubs are up to date."
proto_checks:
needs: [changes, lint, breaking, python-codegen]
name: Proto Checks Pass
runs-on: ubuntu-latest
timeout-minutes: 5
if: always()
steps:
- name: Check all proto jobs
run: |
if [[ "${{ needs.changes.result }}" == "failure" ]]; then
echo "Change detection job failed."
exit 1
fi
if [[ "${{ needs.changes.outputs.proto }}" != "true" ]]; then
echo "Proto checks were skipped (no relevant changes)"
exit 0
fi
if [[ "${{ needs.lint.result }}" != "success" && "${{ needs.lint.result }}" != "skipped" ]]; then
echo "Proto lint failed."
exit 1
fi
if [[ "${{ needs.breaking.result }}" != "success" && "${{ needs.breaking.result }}" != "skipped" ]]; then
echo "Proto breaking change check failed."
exit 1
fi
if [[ "${{ needs.python-codegen.result }}" != "success" && "${{ needs.python-codegen.result }}" != "skipped" ]]; then
echo "Python proto codegen staleness check failed."
exit 1
fi
echo "All proto checks passed."