|
| 1 | +# Copyright 2021 Fangjun Kuang (csukuangfj@gmail.com) |
| 2 | + |
| 3 | +# See ../../LICENSE for clarification regarding multiple authors |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +name: style_check |
| 18 | + |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: |
| 22 | + - master |
| 23 | + pull_request: |
| 24 | + branches: |
| 25 | + - master |
| 26 | + |
| 27 | +jobs: |
| 28 | + style_check: |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + strategy: |
| 31 | + matrix: |
| 32 | + os: [ubuntu-18.04, macos-10.15] |
| 33 | + python-version: [3.7, 3.9] |
| 34 | + fail-fast: false |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v2 |
| 38 | + with: |
| 39 | + fetch-depth: 0 |
| 40 | + |
| 41 | + - name: Setup Python ${{ matrix.python-version }} |
| 42 | + uses: actions/setup-python@v1 |
| 43 | + with: |
| 44 | + python-version: ${{ matrix.python-version }} |
| 45 | + |
| 46 | + - name: Install Python dependencies |
| 47 | + run: | |
| 48 | + python3 -m pip install --upgrade pip black flake8 |
| 49 | +
|
| 50 | + - name: Run flake8 |
| 51 | + shell: bash |
| 52 | + working-directory: ${{github.workspace}} |
| 53 | + run: | |
| 54 | + # stop the build if there are Python syntax errors or undefined names |
| 55 | + flake8 . --count --show-source --statistics |
| 56 | + flake8 . |
| 57 | +
|
| 58 | + - name: Run black |
| 59 | + shell: bash |
| 60 | + working-directory: ${{github.workspace}} |
| 61 | + run: | |
| 62 | + black --check --diff . |
0 commit comments