feat(ci): Run type checking on Sentry #2176
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release/** | |
| pull_request: | |
| jobs: | |
| format: | |
| name: "Code formatting" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Internal github app token | |
| id: token | |
| uses: getsentry/action-github-app-token@97c9e23528286821f97fba885c1b1123284b29cc # v2.0.0 | |
| continue-on-error: true | |
| with: | |
| app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }} | |
| private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }} | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.13 | |
| - run: make install format | |
| - uses: getsentry/action-github-commit@bec0adb2924f8c19a9f84c18c83d375caf02ca38 # main | |
| if: github.event_name == 'pull_request' | |
| with: | |
| github-token: ${{ steps.token.outputs.token }} | |
| - run: git diff --quiet || (echo '::error ::lint produced file changes, run linter locally and try again' && exit 1) | |
| lint-rust: | |
| name: "Linters (Rust)" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| name: Checkout code | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/cache@v3 | |
| name: Restore build cache | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run linter | |
| run: | | |
| make lint-rust | |
| lint-python: | |
| name: "Linters (Python)" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| name: Checkout code | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.13 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| make install | |
| - name: Run linter | |
| run: | | |
| make lint-python | |
| typing: | |
| name: "Type checking" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 2 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| name: Checkout code | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.13 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| make install | |
| - name: Run mypy | |
| run: | | |
| make type-checking | |
| sentry-typing: | |
| name: "Sentry type checking" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| name: Checkout sentry-kafka-schemas | |
| with: | |
| path: sentry-kafka-schemas | |
| - uses: actions/setup-python@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| python-version: 3.13 | |
| - name: Build sentry-kafka-schemas | |
| run: | | |
| cd sentry-kafka-schemas | |
| python -m pip install --upgrade pip | |
| make install | |
| make build | |
| - uses: astral-sh/setup-uv@884ad927a57e558e7a70b92f2bccf9198a4be546 # v6 | |
| name: Setup uv | |
| with: | |
| version: "0.8.2" | |
| enable-cache: false | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| name: Checkout sentry | |
| with: | |
| repository: getsentry/sentry | |
| path: sentry | |
| - uses: getsentry/action-setup-venv@3a832a9604b3e1a4202ae559248f26867b467cc7 # v2.1.1 | |
| with: | |
| python-version: 3.13 | |
| cache-dependency-path: sentry/uv.lock | |
| install-cmd: cd sentry && uv sync --frozen --active | |
| - name: Install sentry-kafka-schemas | |
| run: | | |
| cd sentry | |
| python -m pip install --force-reinstall ../sentry-kafka-schemas/dist/*.whl | |
| - name: Run mypy for sentry | |
| run: | | |
| cd sentry | |
| PYTHONWARNINGS=error::RuntimeWarning mypy | |
| tests: | |
| name: "Run tests" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| python: ["3.10", "3.11", "3.12"] | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| name: Checkout code | |
| - uses: actions/setup-python@v2 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| make install | |
| - name: Run tests | |
| run: make tests | |
| tests-rust: | |
| name: "Run tests (Rust)" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| name: Checkout code | |
| - name: Install protoc | |
| uses: arduino/setup-protoc@v3 | |
| - uses: actions/cache@v3 | |
| name: Restore build cache | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Run tests | |
| run: make tests-rust |