Skip to content

Python Style Check #1082

Python Style Check

Python Style Check #1082

name: Python Style Check
# Cancel previous runs in the PR when you push new commits
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
# Controls when the action will run.
on:
push:
branches: [ main ]
paths:
- 'python/**'
- '.github/workflows/python-style-check.yml'
pull_request:
branches: [ main ]
paths:
- 'python/**'
- '.github/workflows/python-style-check.yml'
schedule:
- cron: '0 16 * * *'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
style-check:
# The type of runner that the job will run on
runs-on: [ self-hosted, Gondolin, ubuntu-20.04-lts ]
strategy:
matrix:
python-version: [3.7]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: pip install pycodestyle
pip install pydocstyle
pip install mypy==0.982
pip install wheel
# Runs a single command using the runners shell
- name: License checking
run: bash python/dev/check-license
- name: Nano style checking
run: |
bash python/nano/test/run-nano-codestyle-test.sh
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Nano type checking [pytorch]
run: |
bash python/nano/dev/build_and_install.sh linux default false pytorch
pip uninstall bigdl-nano -y
rm -rf python/nano/src/build python/nano/src/dist python/nano/src/*egg-info
bash python/nano/test/run-nano-type-test.sh
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Nano type checking [tensorflow]
run: |
bash python/nano/dev/build_and_install.sh linux default false tensorflow
pip uninstall bigdl-nano -y
rm -rf python/nano/src/build python/nano/src/dist python/nano/src/*egg-info
bash python/nano/test/run-nano-type-test.sh
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Dllib style checking
run: bash python/dllib/dev/lint-python
- name: Orca style checking
run: bash python/orca/dev/test/lint-python
- name: Orca type checking
run: bash python/orca/dev/test/run-type-check.sh
env:
BIGDL_HOME: ${{ github.workspace }}
- name: Friesian style checking
run: bash python/friesian/dev/test/lint-python
- name: Chronos style checking
run: bash python/chronos/dev/test/lint-python
- name: Nano style checking
run: bash python/nano/dev/lint-python
- name: PPML style checking
run: bash python/ppml/dev/lint-python
- name: Serving style checking
run: bash python/serving/dev/lint-python
- name: LLM style checking
run: bash python/llm/dev/test/lint-python
create-workflow-badge:
if: github.event.pull_request == ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # actions/checkout@v3
- name: create workflow badge
if: ${{ always() }}
uses: ./.github/actions/create-job-status-badge
with:
secret: ${{ secrets.GIST_SECRET }}
gist-id: 515298657716ead4615f539244730bf0
file-name: python-style-check.json
type: workflow