mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-22 03:14:06 -05:00
69 lines
2.1 KiB
YAML
69 lines
2.1 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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 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
|
|
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: backend/.mypy_cache
|
|
key: mypy-${{ runner.os }}-${{ hashFiles('**/*.py', '**/*.pyi', 'backend/pyproject.toml') }}
|
|
restore-keys: |
|
|
mypy-${{ runner.os }}-
|
|
|
|
- name: Run MyPy
|
|
working-directory: ./backend
|
|
env:
|
|
MYPY_FORCE_COLOR: 1
|
|
TERM: xterm-256color
|
|
run: mypy .
|
|
|
|
- name: Run MyPy (tools/)
|
|
env:
|
|
MYPY_FORCE_COLOR: 1
|
|
TERM: xterm-256color
|
|
run: mypy tools/
|