mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-21 19:02:45 -05:00
72 lines
2.3 KiB
YAML
72 lines
2.3 KiB
YAML
name: Python Checks
|
|
concurrency:
|
|
group: Python-Checks-${{ github.workflow }}-${{ github.head_ref || github.event.workflow_run.head_branch || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
merge_group:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- "release/**"
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
mypy-check:
|
|
# See https://runs-on.com/runners/linux/
|
|
# Note: Mypy seems quite optimized for x64 compared to arm64.
|
|
# Similarly, mypy is single-threaded and incremental, so 2cpu is sufficient.
|
|
runs-on:
|
|
[
|
|
runs-on,
|
|
runner=2cpu-linux-x64,
|
|
"run-id=${{ github.run_id }}-mypy-check",
|
|
"extras=s3-cache",
|
|
]
|
|
timeout-minutes: 45
|
|
|
|
steps:
|
|
- uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Setup Python and Install Dependencies
|
|
uses: ./.github/actions/setup-python-and-install-dependencies
|
|
with:
|
|
requirements: |
|
|
backend/requirements/default.txt
|
|
backend/requirements/dev.txt
|
|
backend/requirements/model_server.txt
|
|
backend/requirements/ee.txt
|
|
|
|
- name: Generate OpenAPI schema and Python client
|
|
shell: bash
|
|
# TODO(Nik): https://linear.app/onyx-app/issue/ENG-1/update-test-infra-to-use-test-license
|
|
env:
|
|
LICENSE_ENFORCEMENT_ENABLED: "false"
|
|
run: |
|
|
ods openapi all
|
|
|
|
- name: Cache mypy cache
|
|
if: ${{ vars.DISABLE_MYPY_CACHE != 'true' }}
|
|
uses: runs-on/cache@50350ad4242587b6c8c2baa2e740b1bc11285ff4 # ratchet:runs-on/cache@v4
|
|
with:
|
|
path: .mypy_cache
|
|
key: mypy-${{ runner.os }}-${{ github.base_ref || github.event.merge_group.base_ref || 'main' }}-${{ hashFiles('**/*.py', '**/*.pyi', 'pyproject.toml') }}
|
|
restore-keys: |
|
|
mypy-${{ runner.os }}-${{ github.base_ref || github.event.merge_group.base_ref || 'main' }}-
|
|
mypy-${{ runner.os }}-
|
|
|
|
- name: Run MyPy
|
|
env:
|
|
MYPY_FORCE_COLOR: 1
|
|
TERM: xterm-256color
|
|
run: mypy .
|