From 130e86276ab1ef6dca70ee6698f8e42da324e399 Mon Sep 17 00:00:00 2001 From: Irfan Alibay Date: Fri, 20 Jan 2023 12:56:41 +0100 Subject: [PATCH] Add doctest step to docs build (#3997) * 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 --- .github/workflows/gh-ci-cron.yaml | 2 +- .github/workflows/gh-ci.yaml | 68 +++--------------- .github/workflows/linters.yaml | 113 ++++++++++++++++++++++++++++++ .github/workflows/mypy.yaml | 52 -------------- README.rst | 6 +- 5 files changed, 127 insertions(+), 114 deletions(-) create mode 100644 .github/workflows/linters.yaml delete mode 100644 .github/workflows/mypy.yaml diff --git a/.github/workflows/gh-ci-cron.yaml b/.github/workflows/gh-ci-cron.yaml index ab549e9e772..849514f49fb 100644 --- a/.github/workflows/gh-ci-cron.yaml +++ b/.github/workflows/gh-ci-cron.yaml @@ -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 diff --git a/.github/workflows/gh-ci.yaml b/.github/workflows/gh-ci.yaml index 6f10c034fb6..88c6c11a825 100644 --- a/.github/workflows/gh-ci.yaml +++ b/.github/workflows/gh-ci.yaml @@ -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 @@ -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 @@ -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: @@ -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/darker@1.5.1 - with: - version: "@master" - options: "--check --diff --color" - src: "./package/MDAnalysis" - revision: "HEAD^" - lint: "flake8" - - - name: darker test code - uses: akaihola/darker@1.5.1 - 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 diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml new file mode 100644 index 00000000000..835277c84da --- /dev/null +++ b/.github/workflows/linters.yaml @@ -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/darker@1.5.1 + with: + version: "@master" + options: "--check --diff --color" + src: "./package/MDAnalysis" + revision: "HEAD^" + lint: "flake8" + + - name: darker test code + uses: akaihola/darker@1.5.1 + 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/ diff --git a/.github/workflows/mypy.yaml b/.github/workflows/mypy.yaml deleted file mode 100644 index 67030503427..00000000000 --- a/.github/workflows/mypy.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: "mypy" -on: - push: - branches: - - develop - pull_request: - branches: - - develop - -concurrency: - - group: "${{ github.ref }}-${{ github.head_ref }}-${{ github.workflow }}" - cancel-in-progress: true - -defaults: - run: - shell: bash -l {0} - -jobs: - 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 - uses-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/ diff --git a/README.rst b/README.rst index 782ec66a6b6..dbce9c56f74 100644 --- a/README.rst +++ b/README.rst @@ -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| @@ -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