-
Notifications
You must be signed in to change notification settings - Fork 677
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Darken action to check for pep8 violations in diffs (#3954)
* Adds darken+flake8 action to lint PRs
- Loading branch information
Showing
2 changed files
with
50 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
max-line-length = 88 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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 |