From d3ffc962dd1d5c8d0ed763a9d05832c153ff15ea Mon Sep 17 00:00:00 2001 From: Robert Smieja Date: Sat, 15 Oct 2022 04:19:16 -0400 Subject: Add basic Pylint to catch syntax errors on PRs --- .github/workflows/on_pull_request.yaml | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/on_pull_request.yaml (limited to '.github/workflows/on_pull_request.yaml') diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml new file mode 100644 index 00000000..5270cba4 --- /dev/null +++ b/.github/workflows/on_pull_request.yaml @@ -0,0 +1,36 @@ +# See https://github.com/actions/starter-workflows/blob/1067f16ad8a1eac328834e4b0ae24f7d206f810d/ci/pylint.yml for original reference file +name: Run Linting/Formatting on Pull Requests + +on: + - push + - pull_request + # See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpull_requestpull_request_targetbranchesbranches-ignore for syntax docs + # if you want to filter out branches, delete the `- pull_request` and uncomment these lines : + # pull_request: + # branches: + # - master + # branches-ignore: + # - development + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: 3.10.6 + - name: Install PyLint + run: | + python -m pip install --upgrade pip + pip install pylint + # This lets PyLint check to see if it can resolve imports + - name: Install dependencies + run : | + export COMMANDLINE_ARGS="--skip-torch-cuda-test --exit" + python launch.py + - name: Analysing the code with pylint + run: | + pylint $(git ls-files '*.py') -- cgit v1.2.3 From 8aaadf56b3d5f06b9bd86718d7518883d94d70a0 Mon Sep 17 00:00:00 2001 From: DancingSnow <1121149616@qq.com> Date: Mon, 17 Oct 2022 09:34:18 +0800 Subject: add cache for workflow --- .github/workflows/on_pull_request.yaml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.github/workflows/on_pull_request.yaml') diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml index 5270cba4..b097d180 100644 --- a/.github/workflows/on_pull_request.yaml +++ b/.github/workflows/on_pull_request.yaml @@ -22,6 +22,12 @@ jobs: uses: actions/setup-python@v3 with: python-version: 3.10.6 + - uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- - name: Install PyLint run: | python -m pip install --upgrade pip -- cgit v1.2.3