Skip to content

Commit

Permalink
Add doctest step to docs build (#3997)
Browse files Browse the repository at this point in the history
* move linters to separate CI file
* don't run darker on merge
* add doctest to docs building step
* CI actions invoke use-mamba not uses-mamba
  • Loading branch information
IAlibay authored Jan 20, 2023
1 parent 0696e11 commit 130e862
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 114 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-ci-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
auto-update-conda: true
channel-priority: flexible
channels: conda-forge, bioconda
uses-mamba: true
use-mamba: true
miniforge-variant: Mambaforge
add-pip-as-python-dependency: true
architecture: x64
Expand Down
68 changes: 8 additions & 60 deletions .github/workflows/gh-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
channel-priority: flexible
channels: conda-forge, bioconda
add-pip-as-python-dependency: true
uses-mamba: true
use-mamba: true
miniforge-variant: Mambaforge
architecture: x64

Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
channels: conda-forge, bioconda
add-pip-as-python-dependency: true
architecture: x64
uses-mamba: true
use-mamba: true
miniforge-variant: Mambaforge

- name: install_deps
Expand All @@ -171,6 +171,12 @@ jobs:
build-tests: false
build-docs: true

- name: doctests
if: github.event_name == 'pull_request'
continue-on-error: true
run: |
cd package && sphinx-build -b doctest --keep-going ./doc/sphinx/source ./doc/html
- name: deploy_docs
if: github.event_name != 'pull_request'
env:
Expand Down Expand Up @@ -226,64 +232,6 @@ jobs:
git push -q upstream HEAD:gh-pages
pylint_check:
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: install
run: |
python -m pip install pylint
- name: pylint
env:
PYLINTRC: package/.pylintrc
run: |
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
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: "linters"
on:
push:
branches:
- develop
pull_request:
branches:
- develop

concurrency:
# Probably overly cautious group naming.
# Commits to develop/master will cancel each other, but PRs will only cancel
# commits within the same PR
group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}"
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

jobs:
darker_lint:
if: |
github.repository == 'MDAnalysis/mdanalysis' &&
github.event_name == 'pull_request'
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"


pylint_check:
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

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

- name: install
run: |
python -m pip install pylint
- name: pylint
env:
PYLINTRC: package/.pylintrc
run: |
pylint package/MDAnalysis && pylint testsuite/MDAnalysisTests
mypy :
if: "github.repository == 'MDAnalysis/mdanalysis'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: setup_miniconda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.8
auto-update-conda: true
channel-priority: flexible
channels: conda-forge, bioconda
add-pip-as-python-dependency: true
use-mamba: true
miniforge-variant: Mambaforge
architecture: x64

- name: install_deps
uses: ./.github/actions/setup-deps
with:
mamba: true
full-deps: true
numpy: numpy=1.20.0

- name: install
run: |
python -m pip install mypy
- name: "Run mypy"
run: |
mypy package/MDAnalysis/
52 changes: 0 additions & 52 deletions .github/workflows/mypy.yaml

This file was deleted.

6 changes: 5 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
MDAnalysis Repository README
================================

|numfocus| |build| |cron| |travis| |cov|
|numfocus| |build| |cron| |travis| |linters| |cov|

|docs| |devdocs| |usergroup| |developergroup| |anaconda| |mybinder| |asv|

Expand Down Expand Up @@ -176,6 +176,10 @@ For citations of included algorithms and sub-modules please see the references_.
:alt: Travis CI Build Status
:target: https://travis-ci.com/MDAnalysis/mdanalysis

.. |linters| image:: https://github.com/MDAnalysis/mdanalysis/actions/workflows/linters.yaml/badge.svg
:alt: Github Actions Linters Status
:target: https://github.com/MDAnalysis/mdanalysis/actions/workflows/linters.yaml

.. |cov| image:: https://codecov.io/gh/MDAnalysis/mdanalysis/branch/develop/graph/badge.svg
:alt: Coverage Status
:target: https://codecov.io/gh/MDAnalysis/mdanalysis
Expand Down

0 comments on commit 130e862

Please sign in to comment.