Skip to content

Commit

Permalink
CI: Add lint-py action (verilator#4640)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsnyder authored Oct 30, 2023
1 parent 15046c6 commit c1c8b30
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# DESCRIPTION: Github actions config
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0

name: lint

on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # weekly

env:
CI_OS_NAME: linux
CI_COMMIT: ${{ github.sha }}

defaults:
run:
shell: bash
working-directory: repo

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
cancel-in-progress: true

jobs:

lint-py:
runs-on: ubuntu-22.04
name: Lint Python
env:
CI_BUILD_STAGE_NAME: build
CI_RUNS_ON: ubuntu-22.04
CI_M32: 0
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: repo

- name: Install packages for build
run: ./ci/ci-install.bash

# We use specific version numbers, otherwise a Python package
# update may add a warning and break our build
- name: Install packages for lint
run: sudo pip3 install pylint==3.0.2 ruff==0.1.3 clang sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe ruff

- name: Configure
run: autoconf && ./configure --enable-longtests --enable-ccwarn

- name: Lint
run: make -k lint-py
10 changes: 8 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,15 @@ PYLINT_FLAGS = --score=n --disable=R0801
RUFF = ruff
RUFF_FLAGS = check --ignore=E402,E501,E701

# "make -k" so can see all tool result errors
lint-py:
-$(PYLINT) $(PYLINT_FLAGS) $(PY_PROGRAMS)
-$(RUFF) $(RUFF_FLAGS) $(PY_PROGRAMS)
$(MAKE) -k lint-py-pylint lint-py-ruff

lint-py-pylint:
$(PYLINT) $(PYLINT_FLAGS) $(PY_PROGRAMS)

lint-py-ruff:
$(RUFF) $(RUFF_FLAGS) $(PY_PROGRAMS)

format-pl-exec:
-chmod a+x test_regress/t/*.pl
Expand Down

0 comments on commit c1c8b30

Please sign in to comment.