onnxruntime

Форк
0
122 строки · 4.0 Кб
1
name: Lint
2

3
on:
4
  push:
5
    branches:
6
      - main
7
      - rel-*
8
  pull_request:
9

10
jobs:
11
  optional-lint:
12
    name: Optional Lint
13
    runs-on: ubuntu-latest
14
    steps:
15
      - uses: actions/checkout@v4
16
      - name: misspell # Check spellings as well
17
        uses: reviewdog/action-misspell@v1
18
        with:
19
          github_token: ${{ secrets.github_token }}
20
          locale: "US"
21
          reporter: github-pr-check
22
          level: info
23
          filter_mode: diff_context
24
      - name: shellcheck # Static check shell scripts
25
        uses: reviewdog/action-shellcheck@v1
26
        with:
27
          github_token: ${{ secrets.github_token }}
28
          reporter: github-pr-check
29
          level: info
30
          filter_mode: file
31

32
  lint-python-format:
33
    # Required workflow
34
    name: Python format
35
    runs-on: ubuntu-latest
36
    steps:
37
      - uses: actions/checkout@v4
38
      - name: Setup Python
39
        uses: actions/setup-python@v5
40
        with:
41
          # Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset.
42
          python-version: "3.10"
43
      - name: Setup Rust
44
        uses: actions-rs/toolchain@v1
45
        with:
46
          toolchain: stable
47
          components: rustfmt
48
      - name: Install dependencies
49
        run: |
50
          python -m pip install -r requirements-dev.txt
51
          python -m pip install lintrunner lintrunner-adapters
52
          lintrunner init
53
      - name: Run lintrunner on all files
54
        run: |
55
          set +e
56
          if ! lintrunner --force-color --all-files --tee-json=lint.json -v; then
57
              echo ""
58
              echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner\`. To set up lintrunner locally, see https://github.com/microsoft/onnxruntime/blob/main/docs/Coding_Conventions_and_Standards.md#linting .\e[0m"
59
              exit 1
60
          fi
61
      - name: Produce SARIF
62
        if: always()
63
        run: |
64
          python -m lintrunner_adapters to-sarif lint.json lintrunner.sarif
65
      - name: Upload SARIF file
66
        if: always()
67
        continue-on-error: true
68
        uses: github/codeql-action/upload-sarif@v3
69
        with:
70
          # Path to SARIF file relative to the root of the repository
71
          sarif_file: lintrunner.sarif
72
          category: lintrunner
73
          checkout_path: ${{ github.workspace }}
74

75
  lint-cpp:
76
    name: Optional Lint C++
77
    runs-on: ubuntu-latest
78
    steps:
79
      - uses: actions/checkout@master
80
      - name: Install ninja
81
        run: python -m pip install --upgrade ninja
82
      - name: Generate compile_commands.json
83
        run: |
84
          python tools/ci_build/build.py \
85
            --cmake_generator "Ninja" \
86
            --build_dir build \
87
            --update \
88
            --cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON
89
      - name: Generate ONNX protobuf files
90
        run: cmake --build build/Debug --config Debug --target onnx_proto
91
      - uses: reviewdog/action-cpplint@master
92
        continue-on-error: true
93
        with:
94
          github_token: ${{ secrets.github_token }}
95
          reporter: github-pr-check
96
          level: info
97
          flags: --linelength=120
98
            --exclude=java/src/main/native/*.c
99
            --exclude=onnxruntime/core/mlas/inc/*
100
            --exclude=onnxruntime/core/mlas/lib/*
101
            --exclude=onnxruntime/contrib_ops/cuda/bert/flash_attention/*
102
            --exclude=build/Debug/*
103
            --exclude=cmake/*
104
            --exclude=csharp/test/*
105
            --exclude=onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/GeneratedShaders/*
106
            --exclude=orttraining/orttraining/test/*
107
            --exclude=onnxruntime/test/*
108
            --exclude=winml/*
109
          filter: "-runtime/references"
110

111
  lint-js:
112
    name: Lint JavaScript
113
    runs-on: ubuntu-latest
114
    steps:
115
      - uses: actions/checkout@v4
116
      - uses: reviewdog/action-eslint@v1
117
        with:
118
          reporter: github-pr-check
119
          level: error
120
          filter_mode: file
121
          eslint_flags: "--ext .ts --ext .tsx"
122
          workdir: "js/"
123

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.