Skip to content

Commit

Permalink
Add Darken action to check for pep8 violations in diffs (#3954)
Browse files Browse the repository at this point in the history
* Adds darken+flake8 action to lint PRs
  • Loading branch information
IAlibay authored Dec 11, 2022
1 parent 526cdd5 commit 8886efa
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 88
74 changes: 48 additions & 26 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,21 +233,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: setup_miniconda
uses: conda-incubator/setup-miniconda@v2
- uses: actions/setup-python@v4
with:
python-version: 3.8
auto-update-conda: true
channel-priority: flexible
channels: conda-forge
add-pip-as-python-dependency: true
architecture: x64

- name: install
run: |
which pip
which python
pip install pylint
python -m pip install pylint
- name: pylint
env:
Expand All @@ -256,37 +248,67 @@ jobs:
pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests
darker_lint:
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: 3.8

- name: darker main code
uses: akaihola/[email protected]
with:
version: "@master"
options: "--check --diff --color"
src: "./package/MDAnalysis"
revision: "HEAD^"
lint: "flake8"

- name: darker test code
uses: akaihola/[email protected]
if: success() || failure()
with:
version: "@master"
options: "--check --diff --color"
src: "./testsuite/MDAnalysisTests"
revision: "HEAD^"
lint: "flake8"


pypi_check:
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./package

steps:
- uses: actions/checkout@v3

- name: setup_miniconda
uses: conda-incubator/setup-miniconda@v2
- uses: actions/setup-python@v4
with:
python-version: 3.8
auto-update-conda: true
channel-priority: flexible
channels: conda-forge
add-pip-as-python-dependency: true
# mamba not enabled as install longer than deps install
architecture: x64

- name: install_pip_conda
- name: install_deps
run: |
# Issue 3612 - readme_renderer is outdated on conda-forge
conda install setuptools cython numpy twine
pip install "readme-renderer>=34.0"
python -m pip install twine "readme-renderer>=34.0"
- name: install_mdanalysis
- name: build_sdist
run: |
cd package && python setup.py sdist
pipx run build --sdist
- name: check_package_build
run: |
DISTRIBUTION=$(ls -t1 package/dist/MDAnalysis-*.tar.gz | head -n 1)
test -n "${DISTRIBUTION}" || { echo "no distribution package/dist/MDAnalysis-*.tar.gz found"; exit 1; }
DISTRIBUTION=$(ls -t1 dist/MDAnalysis-*.tar.gz | head -n 1)
test -n "${DISTRIBUTION}" || { echo "no distribution dist/MDAnalysis-*.tar.gz found"; exit 1; }
echo "twine check $DISTRIBUTION"
twine check $DISTRIBUTION

0 comments on commit 8886efa

Please sign in to comment.