From 9582523741d0c265324759dd2dab32f390da2e2e Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Mon, 18 Jul 2022 21:05:36 +0800 Subject: [PATCH] feat(workflows): run linters in GitHub Actions Signed-off-by: Xuehai Pan --- .github/workflows/lint.yaml | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..4a52eae --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,58 @@ +name: Lint + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + lint: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - name: Cancel previous run + uses: styfle/cancel-workflow-action@0.10.0 + with: + access_token: ${{ github.token }} + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 1 + + - name: Set up Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: "3.9" + update-environment: true + + - name: Upgrade pip + run: | + python -m pip install --upgrade pip setuptools + + - name: Install dependencies + run: | + python -m pip install -r requirements.txt + + - name: Install linters + run: | + python -m pip install --upgrade black isort pylint + + - name: isort + run: | + python -m isort --version + python -m isort --check nvitop + + - name: black + run: | + python -m black --version + python -m black --check nvitop + + - name: pylint + run: | + python -m pylint --version + python -m pylint nvitop